emacs-diffs
[Top][All Lists]
Advanced

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

master 5c1c614940: Make `yank-transform-functions` a proper hook


From: Stefan Monnier
Subject: master 5c1c614940: Make `yank-transform-functions` a proper hook
Date: Tue, 24 May 2022 12:30:02 -0400 (EDT)

branch: master
commit 5c1c614940c35432d048d3879abdcab39c4d4229
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Make `yank-transform-functions` a proper hook
    
    * lisp/subr.el (insert-for-yank): Use `run-hook-wrapped` to run
    `yank-transform-functions`.
    * lisp/simple.el (yank-transform-functions): Adjust accordingly.
---
 lisp/emacs-lisp/package.el | 2 +-
 lisp/simple.el             | 4 ++--
 lisp/subr.el               | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 3a05005fb5..8ddaa9f41d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4284,7 +4284,7 @@ activations need to be changed, such as when 
`package-load-list' is modified."
                   (locate-library (package--autoloads-file-name pkg))))
                (pfile (prin1-to-string file)))
           (insert "(let ((load-true-file-name " pfile ")\
-(load-file-name " pfile "))\n")
+\(load-file-name " pfile "))\n")
           (insert-file-contents file)
           ;; Fixup the special #$ reader form and throw away comments.
           (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move)
diff --git a/lisp/simple.el b/lisp/simple.el
index 1efd900030..3318ac4731 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5947,14 +5947,14 @@ See also `yank-handled-properties'."
   :version "24.3")
 
 (defcustom yank-transform-functions nil
-  "List of functions to run on strings to be yanked.
+  "Hook run on strings to be yanked.
 Each function in this list will be called (in order) with the
 string to be yanked as the sole argument, and should return the (possibly)
 transformed string.
 
 The functions will be called with the destination buffer as the current
 buffer, and with point at the place where the string is to be inserted."
-  :type '(repeat function)
+  :type 'hook
   :version "29.1"
   :group 'killing)
 
diff --git a/lisp/subr.el b/lisp/subr.el
index adcbd94744..0b415d8b2c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4083,8 +4083,8 @@ This function is like `insert', except it honors the 
variables
 
 It also runs the string through `yank-transform-functions'."
   ;; Allow altering the yank string.
-  (dolist (func yank-transform-functions)
-    (setq string (funcall func string)))
+  (run-hook-wrapped 'yank-transform-functions
+                    (lambda (f) (setq string (funcall f string))))
   (let (to)
     (while (setq to (next-single-property-change 0 'yank-handler string))
       (insert-for-yank-1 (substring string 0 to))



reply via email to

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