unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Long buffer names in buffer menu
@ 2009-10-20 17:51 Adam Beneschan
  2009-10-20 21:52 ` B. T. Raven
  2009-10-20 22:20 ` Long buffer names in buffer menu despen
  0 siblings, 2 replies; 14+ messages in thread
From: Adam Beneschan @ 2009-10-20 17:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I've just started using EMACS 22 on Ubuntu (previously was using 20 on
another system), and I've run into a frustrating problem...

When I bring up the electric buffer list, long file names are
truncated (with : at the end of the name).  This is a problem for me
since I'm used to using long source file names, and I sometimes work
with multiple files whose names are different only after the point
where EMACS truncates them.  So if I'm working with two or more such
files, the names appear the same in the electric buffer list and I
don't know which one to select.  I can't find any function that would
display the full, untruncated buffer name somewhere while remanining
in the buffer list so that I can pick the correct one.  Is there a
function like that, or could one be written simply?  (I'm pretty
experienced at writing my own Lisp functions, so if someone has some
code for something like this I could get it working.)

Thanks for any help you can provide.

                             -- thanks, Adam


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

* Re: Long buffer names in buffer menu
  2009-10-20 17:51 Long buffer names in buffer menu Adam Beneschan
@ 2009-10-20 21:52 ` B. T. Raven
  2009-10-20 22:58   ` Drew Adams
  2009-10-21 15:38   ` Adam Beneschan
  2009-10-20 22:20 ` Long buffer names in buffer menu despen
  1 sibling, 2 replies; 14+ messages in thread
From: B. T. Raven @ 2009-10-20 21:52 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Beneschan wrote:
> Hi,
> 
> I've just started using EMACS 22 on Ubuntu (previously was using 20 on
> another system), and I've run into a frustrating problem...
> 
> When I bring up the electric buffer list, long file names are
> truncated (with : at the end of the name).  This is a problem for me
> since I'm used to using long source file names, and I sometimes work
> with multiple files whose names are different only after the point
> where EMACS truncates them.  So if I'm working with two or more such
> files, the names appear the same in the electric buffer list and I
> don't know which one to select.  I can't find any function that would
> display the full, untruncated buffer name somewhere while remanining
> in the buffer list so that I can pick the correct one.  Is there a
> function like that, or could one be written simply?  (I'm pretty
> experienced at writing my own Lisp functions, so if someone has some
> code for something like this I could get it working.)
> 
> Thanks for any help you can provide.
> 
>                              -- thanks, Adam


Look at the uniquify- family of functions (especially the reverse
style), or Options >  use directory names in buffer names, or
buffers-menu-show-directories variable. If you really have buffer names
based on very long file names (part after last slash in fully qualified
path) then you might want to comment out the truncate-lines setq in
ebuff-menu.el I don't know if this is a good idea but Emacs is robust
enough that if that doesn't work, you could later set it back by using
touch -r on ebuff-menu.el to set its times back to something earlier
than ebuff-menu.elc

Ed


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

* Re: Long buffer names in buffer menu
  2009-10-20 17:51 Long buffer names in buffer menu Adam Beneschan
  2009-10-20 21:52 ` B. T. Raven
@ 2009-10-20 22:20 ` despen
  1 sibling, 0 replies; 14+ messages in thread
From: despen @ 2009-10-20 22:20 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Beneschan <adam@irvine.com> writes:

> Hi,
>
> I've just started using EMACS 22 on Ubuntu (previously was using 20 on
> another system), and I've run into a frustrating problem...
>
> When I bring up the electric buffer list, long file names are
> truncated (with : at the end of the name).  This is a problem for me
> since I'm used to using long source file names, and I sometimes work
> with multiple files whose names are different only after the point
> where EMACS truncates them.  So if I'm working with two or more such
> files, the names appear the same in the electric buffer list and I
> don't know which one to select.  I can't find any function that would
> display the full, untruncated buffer name somewhere while remanining
> in the buffer list so that I can pick the correct one.  Is there a
> function like that, or could one be written simply?  (I'm pretty
> experienced at writing my own Lisp functions, so if someone has some
> code for something like this I could get it working.)

I find if I use the arrow key to move into the truncated part of the
line, the buffer list shifts over.

On the other had, ^e doesn't work in the buffer list.  Perhaps you could
add a binding for that.

If the really long names include a bunch of directories, you might try
making symbolic links out of your home directory to the places where
your files are.

Otherwise, I'd say, forget the really long names.  You are just starting
to see the problems they will cause.


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

* RE: Long buffer names in buffer menu
  2009-10-20 21:52 ` B. T. Raven
@ 2009-10-20 22:58   ` Drew Adams
  2009-10-21 15:38   ` Adam Beneschan
  1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-10-20 22:58 UTC (permalink / raw)
  To: help-gnu-emacs

> When I bring up the electric buffer list, long file names are
> truncated (with : at the end of the name).  This is a problem for me
> since I'm used to using long source file names, and I sometimes work
> with multiple files whose names are different only after the point
> where EMACS truncates them.  So if I'm working with two or more such
> files, the names appear the same in the electric buffer list and I
> don't know which one to select.  I can't find any function 
> that would
> display the full, untruncated buffer name somewhere while remanining
> in the buffer list so that I can pick the correct one.  Is there a
> function like that, or could one be written simply?  (I'm pretty
> experienced at writing my own Lisp functions, so if someone has some
> code for something like this I could get it working.)
> 
> Thanks for any help you can provide.

http://www.emacswiki.org/emacs/BufferMenuPlus

You can use `+' and `-' to incrementally resize the buffer name + size. The
smaller they are, the more space there is for the File column.

Lines are not truncated, if you set `truncate-partial-width-windows'.

You can toggle hiding particular columns (e.g. to give more space to others,
such as File).





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

* Re: Long buffer names in buffer menu
  2009-10-20 21:52 ` B. T. Raven
  2009-10-20 22:58   ` Drew Adams
@ 2009-10-21 15:38   ` Adam Beneschan
  2009-10-21 16:25     ` Drew Adams
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Adam Beneschan @ 2009-10-21 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 20, 2:52 pm, "B. T. Raven" <ni...@nihilo.net> wrote:
> Adam Beneschan wrote:
> > Hi,
>
> > I've just started using EMACS 22 on Ubuntu (previously was using 20 on
> > another system), and I've run into a frustrating problem...
>
> > When I bring up the electric buffer list, long file names are
> > truncated (with : at the end of the name).  This is a problem for me
> > since I'm used to using long source file names, and I sometimes work
> > with multiple files whose names are different only after the point
> > where EMACS truncates them.  So if I'm working with two or more such
> > files, the names appear the same in the electric buffer list and I
> > don't know which one to select.  I can't find any function that would
> > display the full, untruncated buffer name somewhere while remanining
> > in the buffer list so that I can pick the correct one.  Is there a
> > function like that, or could one be written simply?  (I'm pretty
> > experienced at writing my own Lisp functions, so if someone has some
> > code for something like this I could get it working.)
>
> > Thanks for any help you can provide.
>
> >                              -- thanks, Adam
>
> Look at the uniquify- family of functions (especially the reverse
> style), or Options >  use directory names in buffer names, or
> buffers-menu-show-directories variable. If you really have buffer names
> based on very long file names (part after last slash in fully qualified
> path) then you might want to comment out the truncate-lines setq in
> ebuff-menu.el I don't know if this is a good idea but Emacs is robust
> enough that if that doesn't work, you could later set it back by using
> touch -r on ebuff-menu.el to set its times back to something earlier
> than ebuff-menu.elc
>
> Ed

Thanks to everyone for the suggestions; unfortunately, nothing seems
to have worked so far.  Yes, the buffer names are based on long file
names *after* the last slash (directory names aren't an issue).  And
using shorter file names is not an option.

I tried using '+' and '-' as suggested by Drew but didn't get
anywhere.  First of all, which + and - did this refer to: the ones on
the numeric keypad, or the "normal" ones?  Anyway, I tried both and
neither worked, but if you can tell me which what functions those are
supposed to be bound to, I could set up something to bind those keys
(or some other keys) and maybe get it to work.  I don't have mouse
capability, by the way.

I don't have ebuff-menu.el.  When I downloaded this via Ubuntu's
package manager, it gave me ebuff-menu.elc but not the .el file.

I'm now thinking that I'll have to track down ebuff-menu.el myself and
take a look at it; if I can do that and figure out how it works,
perhaps I can just write a function that does what I need.  (Really,
just setting up a key that would display the full buffer name in the
minibuffer would be sufficient.)

Once again, thanks.

                                           -- Adam


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

* RE: Long buffer names in buffer menu
  2009-10-21 15:38   ` Adam Beneschan
@ 2009-10-21 16:25     ` Drew Adams
  2009-10-21 16:33     ` despen
       [not found]     ` <mailman.9220.1256142396.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2009-10-21 16:25 UTC (permalink / raw)
  To: 'Adam Beneschan', help-gnu-emacs

> I tried using '+' and '-' as suggested by Drew but didn't get
> anywhere.  First of all, which + and - did this refer to: the ones on
> the numeric keypad, or the "normal" ones?

Both work. By default, in Emacs, keypad keys work the same as the normal-key
counterparts. "By default" here means unless you or some library gives them
different bindings.

> Anyway, I tried both and neither worked,

You must have GNU Emacs 22 or more recent for this feature. It won't work in
Emacs 20/21. And you must have loaded buff-menu+.el (not just the vanilla
buff-menu.el).

> but if you can tell me which what functions those are
> supposed to be bound to, I could set up something to bind those keys
> (or some other keys) and maybe get it to work.  I don't have mouse
> capability, by the way.

`+' is bound to `buffer-menu-increase-max-buffer+size'
`-' is bound to `buffer-menu-decrease-max-buffer+size'

> I don't have ebuff-menu.el.  When I downloaded this via Ubuntu's
> package manager, it gave me ebuff-menu.elc but not the .el file.
> 
> I'm now thinking that I'll have to track down ebuff-menu.el myself and
> take a look at it; if I can do that and figure out how it works,
> perhaps I can just write a function that does what I need.  (Really,
> just setting up a key that would display the full buffer name in the
> minibuffer would be sufficient.)

So there is some confusion as to what you are using. Your initial mail spoke of
buff-menu.el, but it also spoke about "electric" buffer list. Those are two
different things.

What I mentioned to use is buff-menu+.el, which is an extension of the vanilla
buff-menu.el that comes with GNU Emacs. See the URL I pointed you to for more
info.

I know nothing about ebuff-menu.el, sorry.





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

* Re: Long buffer names in buffer menu
  2009-10-21 15:38   ` Adam Beneschan
  2009-10-21 16:25     ` Drew Adams
@ 2009-10-21 16:33     ` despen
       [not found]     ` <mailman.9220.1256142396.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: despen @ 2009-10-21 16:33 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Beneschan <adam@irvine.com> writes:

> On Oct 20, 2:52 pm, "B. T. Raven" <ni...@nihilo.net> wrote:
>> Adam Beneschan wrote:
> I don't have ebuff-menu.el.  When I downloaded this via Ubuntu's
> package manager, it gave me ebuff-menu.elc but not the .el file.
>
> I'm now thinking that I'll have to track down ebuff-menu.el myself and
> take a look at it; if I can do that and figure out how it works,
> perhaps I can just write a function that does what I need.  (Really,
> just setting up a key that would display the full buffer name in the
> minibuffer would be sufficient.)

It took me a while to figure out the package name on Fedora...
I believe it was emacs-el.  It might be the same with the .deb.

What you actually get is ebuff-menu.el.gz.


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

* Re: Long buffer names in buffer menu
       [not found]     ` <mailman.9220.1256142396.2239.help-gnu-emacs@gnu.org>
@ 2009-10-21 16:39       ` despen
  2009-10-21 19:52       ` Adam Beneschan
  1 sibling, 0 replies; 14+ messages in thread
From: despen @ 2009-10-21 16:39 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

> So there is some confusion as to what you are using. Your initial mail spoke of
> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
> different things.

Nope, check yourself.
The Subject line says buffer menu, but the first post in the thread
says Electric Buffer List.

> What I mentioned to use is buff-menu+.el, which is an extension of the vanilla
> buff-menu.el that comes with GNU Emacs. See the URL I pointed you to for more
> info.

One has to wonder how many buffer menus there are.
Electric has always been my favorite, but then I have no need for such
long file names.


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

* Re: Long buffer names in buffer menu
       [not found]     ` <mailman.9220.1256142396.2239.help-gnu-emacs@gnu.org>
  2009-10-21 16:39       ` despen
@ 2009-10-21 19:52       ` Adam Beneschan
  2009-10-22  1:39         ` Long buffer names in buffer menu [Emacs 22.1 on w32] B. T. Raven
  1 sibling, 1 reply; 14+ messages in thread
From: Adam Beneschan @ 2009-10-21 19:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:

> So there is some confusion as to what you are using. Your initial mail spoke of
> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
> different things.

Actually, my initial post didn't mention any .el files.  Just for the
record....

                        -- Adam


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

* Re: Long buffer names in buffer menu [Emacs 22.1 on w32]
  2009-10-21 19:52       ` Adam Beneschan
@ 2009-10-22  1:39         ` B. T. Raven
  2009-10-22  2:32           ` despen
  0 siblings, 1 reply; 14+ messages in thread
From: B. T. Raven @ 2009-10-22  1:39 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Beneschan wrote:
> On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> 
>> So there is some confusion as to what you are using. Your initial mail spoke of
>> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
>> different things.
> 
> Actually, my initial post didn't mention any .el files.  Just for the
> record....
> 
>                         -- Adam

You didn't mention .el files but you did write:

"When I bring up the electric buffer list, long file names are
truncated (with : at the end of the name).  This is a problem for me
since I'm used to using long source file names ... "

I use iswitchb and never electric buffer list but looking into it I found:

C-h f electric-buffer-list

"
electric-buffer-list is an interactive autoloaded Lisp function in
`ebuff-menu'.
(electric-buffer-list ARG)

Pop up a buffer describing the set of Emacs buffers.
Vaguely like ITS lunar select buffer; combining typeoutoid [*] buffer
listing with menuoid buffer selection.

If the very next character typed is a space then the buffer list
window disappears.  Otherwise, one may move around in the buffer list
window, marking buffers to be selected, saved or deleted.

To exit and select a new buffer, type a space when the cursor is on
the appropriate line of the buffer-list window.  Other commands are
much like those of `Buffer-menu-mode'.

Run hooks in `electric-buffer-menu-mode-hook' on entry.
"

*I like that typeoutoid and menuoid lingo. It doesn't sound like RMS's
style.

Then in ebuff-menu.el I noticed the the setq of truncate-lines which
seemed like a likely candidate for explaining the behavior you weren't
liking:
...
 (make-local-variable 'Helper-return-blurb)
  (setq Helper-return-blurb "return to buffer editing")
  (setq truncate-lines t)
  (setq buffer-read-only t)
  (setq major-mode 'Electric-buffer-menu-mode)
...

Btw, see earlier caveats about messing with .el files in emacs/lisp.




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

* Re: Long buffer names in buffer menu [Emacs 22.1 on w32]
  2009-10-22  1:39         ` Long buffer names in buffer menu [Emacs 22.1 on w32] B. T. Raven
@ 2009-10-22  2:32           ` despen
  2009-10-22  6:50             ` Andreas Politz
  2009-10-23 22:53             ` Adam Beneschan
  0 siblings, 2 replies; 14+ messages in thread
From: despen @ 2009-10-22  2:32 UTC (permalink / raw)
  To: help-gnu-emacs

"B. T. Raven" <nihil@nihilo.net> writes:

> Adam Beneschan wrote:
>> On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>> 
>>> So there is some confusion as to what you are using. Your initial mail spoke of
>>> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
>>> different things.
>> 
>> Actually, my initial post didn't mention any .el files.  Just for the
>> record....
>> 
>>                         -- Adam
....
>   (setq truncate-lines t)

Okay, so this sort of works:

(add-hook 'electric-buffer-menu-mode-hook 
	  '(lambda ()
	     (setq truncate-lines nil)))

The long names are shown continued on the next line.
The only problem is that cursor movement moves through
the extended file name.  Not a big problem.



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

* Re: Long buffer names in buffer menu [Emacs 22.1 on w32]
  2009-10-22  2:32           ` despen
@ 2009-10-22  6:50             ` Andreas Politz
  2009-10-23 22:53             ` Adam Beneschan
  1 sibling, 0 replies; 14+ messages in thread
From: Andreas Politz @ 2009-10-22  6:50 UTC (permalink / raw)
  To: help-gnu-emacs

despen@verizon.net writes:

> "B. T. Raven" <nihil@nihilo.net> writes:
>
>> Adam Beneschan wrote:
>>> On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>> 
>>>> So there is some confusion as to what you are using. Your initial mail spoke of
>>>> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
>>>> different things.
>>> 
>>> Actually, my initial post didn't mention any .el files.  Just for the
>>> record....
>>> 
>>>                         -- Adam
> ....
>>   (setq truncate-lines t)
>
> Okay, so this sort of works:
>
> (add-hook 'electric-buffer-menu-mode-hook 
> 	  '(lambda ()
> 	     (setq truncate-lines nil)))
>
> The long names are shown continued on the next line.
> The only problem is that cursor movement moves through
> the extended file name.  Not a big problem.


You could try to flet-bind `abbreviate-file-name' around
`electric-buffer-list' and shorten the filename in which ever way you
like.

-ap





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

* Re: Long buffer names in buffer menu [Emacs 22.1 on w32]
  2009-10-22  2:32           ` despen
  2009-10-22  6:50             ` Andreas Politz
@ 2009-10-23 22:53             ` Adam Beneschan
  2009-10-24  1:05               ` despen
  1 sibling, 1 reply; 14+ messages in thread
From: Adam Beneschan @ 2009-10-23 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 21, 7:32 pm, des...@verizon.net wrote:
> "B. T. Raven" <ni...@nihilo.net> writes:
>
>
>
> > Adam Beneschan wrote:
> >> On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>
> >>> So there is some confusion as to what you are using. Your initial mail spoke of
> >>> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
> >>> different things.
>
> >> Actually, my initial post didn't mention any .el files.  Just for the
> >> record....
>
> >>                         -- Adam
> ....
> >   (setq truncate-lines t)
>
> Okay, so this sort of works:
>
> (add-hook 'electric-buffer-menu-mode-hook
>           '(lambda ()
>              (setq truncate-lines nil)))
>
> The long names are shown continued on the next line.
> The only problem is that cursor movement moves through
> the extended file name.  Not a big problem.

OK, thanks.  I think that will work as a temporary workaround.

                                        -- Adam


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

* Re: Long buffer names in buffer menu [Emacs 22.1 on w32]
  2009-10-23 22:53             ` Adam Beneschan
@ 2009-10-24  1:05               ` despen
  0 siblings, 0 replies; 14+ messages in thread
From: despen @ 2009-10-24  1:05 UTC (permalink / raw)
  To: help-gnu-emacs

Adam Beneschan <adam@irvine.com> writes:

> On Oct 21, 7:32 pm, des...@verizon.net wrote:
>> "B. T. Raven" <ni...@nihilo.net> writes:
>>
>>
>>
>> > Adam Beneschan wrote:
>> >> On Oct 21, 9:25 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
>>
>> >>> So there is some confusion as to what you are using. Your initial mail spoke of
>> >>> buff-menu.el, but it also spoke about "electric" buffer list. Those are two
>> >>> different things.
>>
>> >> Actually, my initial post didn't mention any .el files.  Just for the
>> >> record....
>>
>> >>                         -- Adam
>> ....
>> >   (setq truncate-lines t)
>>
>> Okay, so this sort of works:
>>
>> (add-hook 'electric-buffer-menu-mode-hook
>>           '(lambda ()
>>              (setq truncate-lines nil)))
>>
>> The long names are shown continued on the next line.
>> The only problem is that cursor movement moves through
>> the extended file name.  Not a big problem.
>
> OK, thanks.  I think that will work as a temporary workaround.

How are your eyes?

You could try setting a face in the buffer list and
using a smaller font.

Or a proportional font on the file name.
The WIKI explains how to font lock the electric buffer list.


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

end of thread, other threads:[~2009-10-24  1:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 17:51 Long buffer names in buffer menu Adam Beneschan
2009-10-20 21:52 ` B. T. Raven
2009-10-20 22:58   ` Drew Adams
2009-10-21 15:38   ` Adam Beneschan
2009-10-21 16:25     ` Drew Adams
2009-10-21 16:33     ` despen
     [not found]     ` <mailman.9220.1256142396.2239.help-gnu-emacs@gnu.org>
2009-10-21 16:39       ` despen
2009-10-21 19:52       ` Adam Beneschan
2009-10-22  1:39         ` Long buffer names in buffer menu [Emacs 22.1 on w32] B. T. Raven
2009-10-22  2:32           ` despen
2009-10-22  6:50             ` Andreas Politz
2009-10-23 22:53             ` Adam Beneschan
2009-10-24  1:05               ` despen
2009-10-20 22:20 ` Long buffer names in buffer menu despen

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).