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

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

[nongnu] elpa/engine-mode 4f2abf66d9 53/71: Ensure that local keymaps ar


From: ELPA Syncer
Subject: [nongnu] elpa/engine-mode 4f2abf66d9 53/71: Ensure that local keymaps aren't propagated
Date: Wed, 21 Dec 2022 09:59:16 -0500 (EST)

branch: elpa/engine-mode
commit 4f2abf66d9c9bbe606a7270af9dfaf4199da5f71
Author: Harry R. Schwartz <hello@harryrschwartz.com>
Commit: Harry R. Schwartz <hello@harryrschwartz.com>

    Ensure that local keymaps aren't propagated
    
    To quote from @Ambrevar's issue:
    
    > When point is on a thing that has a local keymap property, the local 
keymap is
    > transferred to the prompt when prompting the initial value. This can
    > potentially break engine.el.
    >
    > Example recipe:
    >
    >     (defun break-message ()
    >       (error "broken"))
    >
    >     (defun break ()
    >       (let ((map (make-sparse-keymap)))
    >         (define-key map (kbd "<return>") 'break-message)
    >         (add-text-properties
    >          (point-min) (+ 10 (point-min))
    >          `(local-map ,map))))
    >
    > Now call the above in a buffer that starts with foo bar, place the point 
on
    > foo, call on engine search and press M-n. From there, you won't be able to
    > press enter.
    
    This fix ensures that the properties of `thing-at-point` won't be 
propagated to
    the prompt.
    
    Nice catch, @Ambrevar, and thanks again! Fixes #43.
---
 engine-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/engine-mode.el b/engine-mode.el
index e9b274fd53..21c014cf39 100644
--- a/engine-mode.el
+++ b/engine-mode.el
@@ -93,7 +93,7 @@ Defaults to `nil' which means to go with 
`browse-url-browser-function'."
     (format "Search %s (%s): " (capitalize engine-name) default-word)))
 
 (defun engine/prompted-search-term (engine-name)
-  (let ((current-word (or (thing-at-point 'symbol) "")))
+  (let ((current-word (or (thing-at-point 'symbol 'no-properties) "")))
     (read-string (engine/search-prompt engine-name current-word)
      nil nil current-word)))
 



reply via email to

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