emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Kill ring leak in winemacs macros]


From: Kevin Rodgers
Subject: Re: address@hidden: Kill ring leak in winemacs macros]
Date: Wed, 03 Aug 2005 17:12:25 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Stuart D. Herring wrote:
> The variables `interprogram-cut-function' and
> `interprogram-paste-function' can be set to nil to suppress the
> synchronization, but this isn't just a customization issue (as in
> "this isn't a problem, you should set X to Y") because the issue only
> arises during keyboard macro execution.  If we want to support this,
> presumably we want a new variable thusly:
>
> (defcustom macro-private-kills nil
>   "*Non-nil means kill and yank commands executed by a keyboard macro
> don't interact with window system cut and paste facilities."
>   :type 'boolean
>   :group 'killing
>   :version "22.1")
>
> Then `kill-new', `kill-append', and `current-kill' would be modified to
> ignore `interprogram-*-function' if `macro-private-kills' is set and a
> keyboard macro is executing.

It would be simpler to temporarily bind the interprogram-*-functions
variables to nil in execute-kbd-macro.

> Better variable names and/or docstrings are of course welcome.

How about:

(defcustom kbd-macro-disable-interprogram-functions nil
  "Disable `interprogram-cut-function' and `interprogram-paste-function'
while executing a keyboard macro.  This allows keyboard macros to run
independently of other programs."
  :type 'boolean
  :group 'killing) ; no keyboard macro or window system group

(defadvice execute-kbd-macro (around
                              kbd-macro-disable-interprogram-functions
                              activate)
  "Respect `kbd-macro-disable-interprogram-fuctions'."
  (let ((interprogram-cut-function
         (if kbd-macro-disable-interprogram-functions
             nil
           interprogram-cut-function))
        (interprogram-paste-function
         (if kbd-macro-disable-interprogram-functions
             nil
           interprogram-paste-function)))
    ad-do-it))

Or perhaps -ignore- is preferred over -disable- in variable names.

P.S.  I know that execute-kbd-macro is a built-in function defined in
src/macros.c, and defadvice is not allowed in the lisp/*.el files.  This
is for illustration only.

--
Kevin Rodgers





reply via email to

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