emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/objed a5684df 156/166: Add objed-switch-functions (#57)


From: Clemens Radermacher
Subject: [elpa] externals/objed a5684df 156/166: Add objed-switch-functions (#57)
Date: Sun, 29 Dec 2019 08:21:19 -0500 (EST)

branch: externals/objed
commit a5684df7d4f866a8616a59c32521a7360638c11d
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    Add objed-switch-functions (#57)
---
 objed.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/objed.el b/objed.el
index 01185c8..c15735e 100644
--- a/objed.el
+++ b/objed.el
@@ -258,7 +258,7 @@ The function should return nil if objed should not 
initialize."
                 :value-type (choice sexp
                                     (repeat sexp))))
 
-(defcustom objed-switch-alist  '((t . objed-switch-goto-beg))
+(defcustom objed-switch-alist  '()
   "Alist mapping objects to region functions.
 
 When switching to an object interactively using its object
@@ -273,6 +273,14 @@ object exists."
   :type '(alist :key-type sexp
                 :value-type function))
 
+(defcustom objed-switch-functions '(objed-switch-goto-beg)
+  "Hook that runs after switching to an object.
+
+Functions in this hook get the object name, start and end
+position as arguments. This hook runs after any mappings in
+`objed-switch-alist'."
+  :type 'hook)
+
 
 (defcustom objed-states-max 20
   "Maximal number of states to remember.
@@ -548,7 +556,7 @@ object as an argument."
 
 Don't modify this list manually, use `objed-define-dispatch'.")
 
-(defun objed-switch-goto-beg (beg _end)
+(defun objed-switch-goto-beg (_obj beg _end)
   "Move to BEG.
 
 Used as default for `objed-switch-alist'."
@@ -576,7 +584,9 @@ update to given object."
              (let ((switcher (or (assq name objed-switch-alist)
                                  (assq t objed-switch-alist))))
                (when switcher
-                 (funcall (cdr switcher) (objed--beg) (objed--end)))))))))
+                 (funcall (cdr switcher) (objed--beg) (objed--end))))
+             (run-hook-with-args 'objed-switch-functions name
+                                 (objed--beg) (objed--end)))))))
 
 
 (defun objed--switch-to-object-for-cmd (cmd)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]