emacs-devel
[Top][All Lists]
Advanced

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

Re: Question: suppress ask-user-about-lock?


From: Matt Armstrong
Subject: Re: Question: suppress ask-user-about-lock?
Date: Wed, 08 Dec 2021 14:03:29 -0800

Qiantan Hong <qhong@mit.edu> writes:

>> What about (untested)
>> 
>> (cl-letf (((symbol-function #'ask-user-about-lock)
>>           (lambda (file proponent)
>>             (signal 'file-locked (list file proponent)))))
>> 
>> ...)
>
> I guess it will break under multi-thread environment?  Because FLET,
> or function cells in general, are not thread local.

(info "(elisp)Threads") talks about `let' bindings being thread local.
I always took that to apply to the other let-like bindings as well.  It
looks like `cl-letf' uses `let*' under the hood.


> I also feel like the above is as hacky as my (let ((noninteractive t))
> (lock-buffer)) Does anyone have more recommendations?

It think it feels hacky because `ask-user-about-lock' is a decades old
API and was probably introduced before the abnormal hook convention took
hold (info "(elisp)Standard Hooks").  I suspect that back then
redefining functions as a customization point was more common.

If the API were added today I think you'd see an
`ask-user-about-lock-function' (or functions) var that is bound to
#'ask-user-about-lock by default.  The Emacs C layer would then funcall
it.



reply via email to

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