GNU bug report logs - #76248
[Feature Request] user-option for killing buffer in `quit-window'.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Perez <eg642616 <at> gmail.com>

Date: Thu, 13 Feb 2025 04:45:01 UTC

Severity: wishlist

Full log


Message #47 received at submit <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Elijah Gabe Perez <eg642616 <at> gmail.com>,
 martin rudalics via Bug reports for GNU "Emacs, " the Swiss army knife of text
 editors <bug-gnu-emacs <at> gnu.org>
Cc: 76248 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76248: [Feature Request] user-option for killing buffer in
 `quit-window'.
Date: Sat, 15 Feb 2025 11:35:32 +0100
[Message part 1 (text/plain, inline)]
> Shouldn't it be something like this?
>
> +  :type '(choice (repeat (symbol :tag "Major mode")) boolean)
> +  :version "31.1"
> +  :group 'windows)
>
> Otherwise it would give a warning due type.

Right.

>> +  (let (kill-from-mode)
>> +    (with-current-buffer (window-buffer (window-normalize-window window))
>> +      ;; Run the hook from the buffer implied to get any buffer-local
>> +      ;; values.
>> +      (run-hooks 'quit-window-hook)
>> +
>> +      (setq kill-from-mode
>> +	    (or (eq quit-window-kill-buffer-modes t)
>> +		(and (listp quit-window-kill-buffer-modes)
>> +		     (derived-mode-p quit-window-kill-buffer-modes)))))
>
> Wouldn't it be more convenient to put this into the let varlist?

It would be more convenient ...

> +  (let ((kill-from-mode
> +         (or (eq quit-window-kill-buffer-modes t)
> +		      (and (listp quit-window-kill-buffer-modes)
> +		           (derived-mode-p quit-window-kill-buffer-modes)))))
>
>
> ... or is there something i'm missing?

... but 'derived-mode-p' says to

 "Return non-nil if the current major mode is derived from one of MODES.

so I have to make the buffer current first via 'with-current-buffer' and
only then I can call 'derived-mode-p'.

martin
[quit-window-kill-buffer.diff (text/x-patch, attachment)]

This bug report was last modified 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.