unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called
@ 2019-05-13 17:02 Xu Chunyang
  2019-06-07  9:27 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Xu Chunyang @ 2019-05-13 17:02 UTC (permalink / raw)
  To: 35718

Hi,

I want to change how image is pasted (e.g., save the image to disk and
insert a markdown image link). When I play with yank-handled-properties:

    (add-to-list 'yank-handled-properties '(image . foo))
    
    (defun foo (image beg end)
      (message "=> %S %S %S" image beg end))

However, the function foo is always called even there is no image at
all. This is unexpected since the function should only be called when
the property 'image is found according to the documentation:

    When the `yank' command inserts text into the buffer, it scans the
    inserted text for stretches of text that have `eq' values of the text
    property PROP; for each such stretch of text, FUN is called with three
    arguments...

The function is called inside remove-yank-excluded-properties, however
FUN is always called no matter what PROP is:

    (while (< run-start end)
      (let ((value (get-text-property run-start prop))
            (run-end (next-single-property-change
                      run-start prop nil end)))
        (funcall fun value run-start run-end)
        (setq run-start run-end)))


--
In GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.0, Carbon Version 158 AppKit 1671.4)
 of 2019-04-20 built on Chunyangs-MacBook-Air.local
Repository revision: d21490f428a6baf568ad0669425b4a7b39a6bd73
Windowing system distributor 'Apple Inc.', version 10.14.4





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-22 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13 17:02 bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called Xu Chunyang
2019-06-07  9:27 ` Eli Zaretskii
2019-06-07 13:03   ` Noam Postavsky
2021-06-22 14:25     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).