summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kaludercic <philip.kaludercic@fau.de>2023-07-19 20:04:56 +0000
committerPhilip Kaludercic <philip.kaludercic@fau.de>2023-07-19 20:04:56 +0000
commitffd013c6d2b7f172d4f2c1ef2781d972b4c7f7ef (patch)
tree2f5f00d7f402a453f568a35d15b08e53ca0aab17
parent80ca91520be7003671cee1f2dd3c1655bba2d69d (diff)
Add user option to disable quick bindings
-rw-r--r--do-at-point.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/do-at-point.el b/do-at-point.el
index f5e7d86..3e55155 100644
--- a/do-at-point.el
+++ b/do-at-point.el
@@ -5,7 +5,7 @@
;; Author: Philip Kaludercic <philipk@posteo.net>
;; Maintainer: Philip Kaludercic <philipk@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