unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
@ 2016-11-18 11:15 Tino Calancha
  2016-11-18 12:41 ` Tino Calancha
  2016-11-18 14:31 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Tino Calancha @ 2016-11-18 11:15 UTC (permalink / raw)
  To: 24962; +Cc: Tino Calancha


emacs -Q -eval '(write-region "foo" nil (expand-file-name temporary-file-directory "foo"))'
  M-: (find-file (expand-file-name temporary-file-directory "foo")) RET
  M-: (rename-buffer " foo") RET
  C-x C-b
  ;; Buffer " foo" not listed.

From the Emacs manual:
doc/lispref/buffers.texi (Buffer Names):
Buffers that are ephemeral and generally uninteresting to the user
have names starting with a space, so that the @code{list-buffers} and
@code{buffer-menu} commands don't mention them (but if such a buffer
visits a file, it @strong{is} mentioned).

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 5f86fb83f6dcb65a3cbb03b3a09306f0375deb5a Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Fri, 18 Nov 2016 20:07:15 +0900
Subject: [PATCH] List buffers with name starting with " " if they visit a file

* lisp/buff-menu.el (list-buffers--refresh)
---
  lisp/buff-menu.el | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 4742628..2949409 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -633,7 +633,8 @@ list-buffers--refresh
  	       (file buffer-file-name))
  	  (when (and (buffer-live-p buffer)
  		     (or buffer-list
-			 (and (not (string= (substring name 0 1) " "))
+			 (and (or (not (string= (substring name 0 1) " "))
+                                  file)
  			      (not (eq buffer buffer-menu-buffer))
  			      (or file show-non-file))))
  	    (push (list buffer
-- 
2.10.2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.3)
  of 2016-11-16
Repository revision: 6653bb45d3697c9372cc77773c49f52399740b51





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 11:15 bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file Tino Calancha
@ 2016-11-18 12:41 ` Tino Calancha
  2016-11-18 14:31 ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2016-11-18 12:41 UTC (permalink / raw)
  To: 24962; +Cc: Tino Calancha

Tino Calancha <tino.calancha@gmail.com> writes:

> emacs -Q -eval '(write-region "foo" nil (expand-file-name temporary-file-directory "foo"))'
>  M-: (find-file (expand-file-name temporary-file-directory "foo")) RET
>  M-: (rename-buffer " foo") RET
>  C-x C-b
>  ;; Buffer " foo" not listed.
The order in expand-file-name arguments is inverted;  it should be:
(expand-file-name "foo" temporary-file-directory)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 11:15 bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file Tino Calancha
  2016-11-18 12:41 ` Tino Calancha
@ 2016-11-18 14:31 ` Eli Zaretskii
  2016-11-18 16:48   ` Clément Pit--Claudel
  2016-12-08  4:54   ` Tino Calancha
  1 sibling, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-18 14:31 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 24962

> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Fri, 18 Nov 2016 20:15:52 +0900 (JST)
> Cc: Tino Calancha <tino.calancha@gmail.com>
> 
> emacs -Q -eval '(write-region "foo" nil (expand-file-name temporary-file-directory "foo"))'
>   M-: (find-file (expand-file-name temporary-file-directory "foo")) RET
>   M-: (rename-buffer " foo") RET
>   C-x C-b
>   ;; Buffer " foo" not listed.
> 
> >From the Emacs manual:
> doc/lispref/buffers.texi (Buffer Names):
> Buffers that are ephemeral and generally uninteresting to the user
> have names starting with a space, so that the @code{list-buffers} and
> @code{buffer-menu} commands don't mention them (but if such a buffer
> visits a file, it @strong{is} mentioned).

Thank.  Please add a test for this to the test suite.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 14:31 ` Eli Zaretskii
@ 2016-11-18 16:48   ` Clément Pit--Claudel
  2016-11-18 17:09     ` Eli Zaretskii
  2016-11-30  2:59     ` Tino Calancha
  2016-12-08  4:54   ` Tino Calancha
  1 sibling, 2 replies; 8+ messages in thread
From: Clément Pit--Claudel @ 2016-11-18 16:48 UTC (permalink / raw)
  To: 24962


[-- Attachment #1.1: Type: text/plain, Size: 1055 bytes --]

On 2016-11-18 09:31, Eli Zaretskii wrote:
>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Fri, 18 Nov 2016 20:15:52 +0900 (JST)
>> Cc: Tino Calancha <tino.calancha@gmail.com>
>>
>> emacs -Q -eval '(write-region "foo" nil (expand-file-name temporary-file-directory "foo"))'
>>   M-: (find-file (expand-file-name temporary-file-directory "foo")) RET
>>   M-: (rename-buffer " foo") RET
>>   C-x C-b
>>   ;; Buffer " foo" not listed.
>>
>> >From the Emacs manual:
>> doc/lispref/buffers.texi (Buffer Names):
>> Buffers that are ephemeral and generally uninteresting to the user
>> have names starting with a space, so that the @code{list-buffers} and
>> @code{buffer-menu} commands don't mention them (but if such a buffer
>> visits a file, it @strong{is} mentioned).
> 
> Thank.  Please add a test for this to the test suite.

Could we fix the manual instead? Or do we have evidence that all modes that use temporary buffers visiting files set buffer-file-name to nil to prevent these buffers from being listed?

Clément.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 16:48   ` Clément Pit--Claudel
@ 2016-11-18 17:09     ` Eli Zaretskii
  2016-11-30  3:22       ` Clément Pit--Claudel
  2016-11-30  2:59     ` Tino Calancha
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-11-18 17:09 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 24962

> From: Clément Pit--Claudel <clement.pit@gmail.com>
> Date: Fri, 18 Nov 2016 11:48:07 -0500
> 
> >> >From the Emacs manual:
> >> doc/lispref/buffers.texi (Buffer Names):
> >> Buffers that are ephemeral and generally uninteresting to the user
> >> have names starting with a space, so that the @code{list-buffers} and
> >> @code{buffer-menu} commands don't mention them (but if such a buffer
> >> visits a file, it @strong{is} mentioned).
> > 
> > Thank.  Please add a test for this to the test suite.
> 
> Could we fix the manual instead? Or do we have evidence that all modes that use temporary buffers visiting files set buffer-file-name to nil to prevent these buffers from being listed?

I'm not sure what use case you have in mind.  Usually, temporary
buffers don't visit files, those files are inserted into temporary
buffers without affecting buffer-file-name.  But maybe you are talking
about some scenario I'm missing.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 16:48   ` Clément Pit--Claudel
  2016-11-18 17:09     ` Eli Zaretskii
@ 2016-11-30  2:59     ` Tino Calancha
  1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2016-11-30  2:59 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 24962

Clément Pit--Claudel <clement.pit@gmail.com> writes:

> Could we fix the manual instead? Or do we have evidence that all modes
> that use temporary buffers visiting files set buffer-file-name to nil
> to prevent these buffers from being listed?
They shouln't automatically set `buffer-file-name', that is up to the
user.  Indeed, as Eli said, temporary buffers has such variable set to nil.

Ibuffer doesn't show the buffer ' foo' visiting a file by default.
Well, that is customizable using `ibuffer-maybe-show-predicates'.
A prefix argument in `ibuffer-update' toggle this variable.

One user might intentionally or accidentaly change the name
of a buffer visiting a file.  If we don't show it in `list-buffers'
the user might believe that the file has being deleted.
IMO one buffer visiting a file is always relevant; it's better if
we show it.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 17:09     ` Eli Zaretskii
@ 2016-11-30  3:22       ` Clément Pit--Claudel
  0 siblings, 0 replies; 8+ messages in thread
From: Clément Pit--Claudel @ 2016-11-30  3:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 24962


[-- Attachment #1.1: Type: text/plain, Size: 1048 bytes --]

On 2016-11-18 12:09, Eli Zaretskii wrote:
>> From: Clément Pit--Claudel <clement.pit@gmail.com>
>> Date: Fri, 18 Nov 2016 11:48:07 -0500
>>
>>>> >From the Emacs manual:
>>>> doc/lispref/buffers.texi (Buffer Names):
>>>> Buffers that are ephemeral and generally uninteresting to the user
>>>> have names starting with a space, so that the @code{list-buffers} and
>>>> @code{buffer-menu} commands don't mention them (but if such a buffer
>>>> visits a file, it @strong{is} mentioned).
>>>
>>> Thank.  Please add a test for this to the test suite.
>>
>> Could we fix the manual instead? Or do we have evidence that all modes that use temporary buffers visiting files set buffer-file-name to nil to prevent these buffers from being listed?
> 
> I'm not sure what use case you have in mind.  Usually, temporary
> buffers don't visit files, those files are inserted into temporary
> buffers without affecting buffer-file-name.  But maybe you are talking
> about some scenario I'm missing.

Just a vague worry; no special scenario.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file
  2016-11-18 14:31 ` Eli Zaretskii
  2016-11-18 16:48   ` Clément Pit--Claudel
@ 2016-12-08  4:54   ` Tino Calancha
  1 sibling, 0 replies; 8+ messages in thread
From: Tino Calancha @ 2016-12-08  4:54 UTC (permalink / raw)
  To: 24962-done

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Fri, 18 Nov 2016 20:15:52 +0900 (JST)
>> Cc: Tino Calancha <tino.calancha@gmail.com>
>> 
>> emacs -Q -eval '(write-region "foo" nil (expand-file-name temporary-file-directory "foo"))'
>>   M-: (find-file (expand-file-name temporary-file-directory "foo")) RET
>>   M-: (rename-buffer " foo") RET
>>   C-x C-b
>>   ;; Buffer " foo" not listed.
>> 
>> >From the Emacs manual:
>> doc/lispref/buffers.texi (Buffer Names):
>> Buffers that are ephemeral and generally uninteresting to the user
>> have names starting with a space, so that the @code{list-buffers} and
>> @code{buffer-menu} commands don't mention them (but if such a buffer
>> visits a file, it @strong{is} mentioned).
>
> Thank.  Please add a test for this to the test suite.
I don't see further comments so i've pushed a fix to the
master branch as commit af96803.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-08  4:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 11:15 bug#24962: 26.0.50; list-buffers doesn't show buffers w/ name " "... visiting a file Tino Calancha
2016-11-18 12:41 ` Tino Calancha
2016-11-18 14:31 ` Eli Zaretskii
2016-11-18 16:48   ` Clément Pit--Claudel
2016-11-18 17:09     ` Eli Zaretskii
2016-11-30  3:22       ` Clément Pit--Claudel
2016-11-30  2:59     ` Tino Calancha
2016-12-08  4:54   ` Tino Calancha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).