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

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

bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffe


From: Philip K.
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Tue, 21 Jul 2020 20:35:55 +0200

Thanks for the input, I'll try to fix everything you mentioned.

Eli Zaretskii <eliz@gnu.org> writes:

>>  (defun project-kill-buffers ()
>>    "Kill all live buffers belonging to the current project.
>> @@ -873,17 +941,13 @@ project-kill-buffers
>>    (interactive)
>>    (let ((pr (project-current t)) bufs)
>>      (dolist (buf (project--buffer-list pr))
>> -      (unless (seq-some
>> -               (lambda (c)
>> -                 (cond ((stringp c)
>> -                        (string-match-p c (buffer-name buf)))
>> -                       ((functionp c)
>> -                        (funcall c buf))))
>> -               project-kill-buffers-ignores)
>> +      (when (project--kill-buffer-check buf project-kill-buffer-conditions)
>>          (push buf bufs)))
>> -    (when (yes-or-no-p (format "Kill %d buffers in %s? "
>> -                               (length bufs) (project-root pr)))
>> -      (mapc #'kill-buffer bufs))))
>> +    (if (null bufs)
>> +        (message "No buffers to kill")
>> +      (when (yes-or-no-p (format "Kill %d buffers in %s? "
>> +                                 (length bufs) (project-root pr)))
>> +        (mapc #'kill-buffer bufs)))))
>
> Is this function intended to never be invoked from Lisp?  If it can be
> invoked from Lisp, then asking the yes-or-no-p question might not be
> appropriate in the non-interactive case

So would you suggest factoring out that programmatic part or checking if
the command was invoked interactively?

> (and the "No buffers to kill" message might be spared as well).

I added "No buffers to kill", because if you're in a buffer that isn't
killed, calling project-kill-buffers seems to have no effect.

-- 
        Philip K.





reply via email to

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