bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called


From: Xu Chunyang
Subject: bug#35718: 26.2; Functions in yank-handled-properties ALWAYS get called
Date: Tue, 14 May 2019 01:02:11 +0800
User-agent: Emacs/26.2 using message.el and smtpmail.el

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





reply via email to

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