branch: externals/do-at-point commit ffd013c6d2b7f172d4f2c1ef2781d972b4c7f7ef Author: Philip Kaludercic <philip.kaluder...@fau.de> Commit: Philip Kaludercic <philip.kaluder...@fau.de>
Add user option to disable quick bindings --- do-at-point.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/do-at-point.el b/do-at-point.el index f5e7d866a1..3e55155165 100644 --- a/do-at-point.el +++ b/do-at-point.el @@ -5,7 +5,7 @@ ;; Author: Philip Kaludercic <phil...@posteo.net> ;; Maintainer: Philip Kaludercic <phil...@posteo.net> ;; URL: https://wwwcip.cs.fau.de/~oj14ozun/src+etc/do-at-point.el -;; Version: $Id: do-at-point.el,v 1.13 2023/07/18 07:57:21 oj14ozun Exp oj14ozun $ +;; Version: $Id: do-at-point.el,v 1.14 2023/07/19 20:01:11 oj14ozun Exp oj14ozun $ ;; Package-Version: 1 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: convenience @@ -141,6 +141,12 @@ Refer to the user option `do-at-point-actions' for details on the structure of the values of this user option." :type do-at-point-actions-type) +(defcustom do-at-point-quick-bindings nil + "Non-nil means that quick bindings are enabled. +Quick bindings allow for the user to operate on a selection +without having to have confirmed the first. This might interfere with " + :type 'boolean) + (defvar-local do-at-point-local-actions '() "Actions that can be added by a major or minor mode. These are prioritised to the user option `do-at-point-actions', @@ -252,8 +258,11 @@ value of the function is always the new \"thing\"." (prog1 (overlay-put do-at-point--overlay 'do-at-point-thing thing) ;; clear and reinitialise the shortcut map (setcdr do-at-point--shortcut-map nil) - (dolist (key (mapcar #'car (do-at-point--actions thing))) - (define-key do-at-point--shortcut-map (vector key) #'do-at-point-confirm)) + (when do-at-point-quick-bindings + (dolist (key (mapcar #'car (do-at-point--actions thing))) + (define-key do-at-point--shortcut-map (vector key) #'do-at-point-confirm)) + (define-key do-at-point--shortcut-map (kbd "<return>") + #'do-at-point-confirm-quick)) (let ((default (cadar (do-at-point--actions thing)))) (message "Act on `%s' (%s by default)?" thing default)) (unless no-update