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

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

Re: electric-buffer-list family-size trailing whitespace


From: Kevin Rodgers
Subject: Re: electric-buffer-list family-size trailing whitespace
Date: Fri, 01 Oct 2004 10:33:25 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Dan Jacobson wrote:
>>>Note that buffers with names starting with spaces are omitted.
>>>
>>Well, mention there how to list them too. Sizes and all.
>>
> K> Do you mean `electric-buffer-list'?
>
> electric-buffer-list doesn't list them either.

But it does list their size, mode, and file -- just like list-buffers.

>   electric-buffer-list is an interactive compiled Lisp function in 
`ebuff-menu'.
>   (electric-buffer-list ARG)
> And then the docstring forgets to mention what ARG is.

It works just like list-buffers:

Non-null optional arg FILES-ONLY means mention only file buffers.

> And whatever
> it is it doesn't show buffers starting with spaces, nor does I bet
> its docstring mention how.

Try the patches below, for both list-buffers and electric-buffer-list.

2004-10-04  Kevin Rodgers  <address@hidden>

            * buff-menu.el (list-internal-buffers): New option.
            (list-internal-buffers): New command.
            (list-buffers, list-buffers-noselect): Document and respect
            new option.

2004-10-04  Kevin Rodgers  <address@hidden>

            * ebuff-menu.el (electric-buffer-list): Rename and document
              optional FILES-ONLY prefix arg; document new
              list-internal-buffers option.

> Most annoying is if one uses electric-buffer-list with
> (setq show-trailing-whitespace t)
> The loads of trailing whitespace were obviously not caught in the
> review phase of the electric-buffer-list project.

It behaves the same as list-buffers.  Try this:

(add-hook 'buffer-menu-mode-hook
          (lambda () (set (make-local-variable show-trailing-whitespace) nil)))

> Nope, too electric for me. Plus banging C-h tells you to hit a "?"
> when a second C-h would work just as well.

Emacs is the extensible, customizable, self-documenting real-time
display editor:

(define-key electric-buffer-menu-mode-map "\C-h" 'Helper-describe-bindings)

--
Kevin Rodgers

*** emacs-21.3/lisp/buff-menu.el~       Wed Aug 29 08:53:31 2001
--- emacs-21.3/lisp/buff-menu.el        Fri Oct  1 10:00:42 2004
***************
*** 463,472 ****

  (define-key ctl-x-map "\C-b" 'list-buffers)

  (defun list-buffers (&optional files-only)
    "Display a list of names of existing buffers.
  The list is displayed in a buffer named `*Buffer List*'.
! Note that buffers with names starting with spaces are omitted.
  Non-null optional arg FILES-ONLY means mention only file buffers.

  The M column contains a * for buffers that are modified.
--- 463,486 ----

  (define-key ctl-x-map "\C-b" 'list-buffers)

+ (defvar list-internal-buffers nil
+   "*If non-nil, `list-buffers' displays buffers whose names start with a 
space.
+ If non-nil and not t, it only displays buffers whose names start with a space.
+ See `list-buffers-no-select'.")
+
+ (defun list-internal-buffers ()
+   "Display a list of names of existing buffers whose names start with a space.
+ See `list-buffers'."
+   (interactive)
+   (display-buffer (let ((list-internal-buffers 'only))
+                     (list-buffers-noselect nil))))
+
+
  (defun list-buffers (&optional files-only)
    "Display a list of names of existing buffers.
  The list is displayed in a buffer named `*Buffer List*'.
! Note that buffers with names starting with spaces are omitted
! unless `list-internal-buffers' is non-nil.
  Non-null optional arg FILES-ONLY means mention only file buffers.

  The M column contains a * for buffers that are modified.
***************
*** 477,483 ****
  (defun list-buffers-noselect (&optional files-only)
    "Create and return a buffer with a list of names of existing buffers.
  The buffer is named `*Buffer List*'.
! Note that buffers with names starting with spaces are omitted.
  Non-null optional arg FILES-ONLY means mention only file buffers.

  The M column contains a * for buffers that are modified.
--- 491,500 ----
  (defun list-buffers-noselect (&optional files-only)
    "Create and return a buffer with a list of names of existing buffers.
  The buffer is named `*Buffer List*'.
! Note that buffers with names starting with spaces are omitted
! unless `list-internal-buffers' is non-nil.  If `list-internal-buffers'
! is non-nil and not t, only buffers whose names start with a space
! are displayed.
  Non-null optional arg FILES-ONLY means mention only file buffers.

  The M column contains a * for buffers that are modified.
***************
*** 514,521 ****
                           list-buffers-directory)
                  (setq this-buffer-directory list-buffers-directory))))
            (cond
!             ;; Don't mention internal buffers.
!             ((string= (substring name 0 1) " "))
              ;; Maybe don't mention buffers without files.
              ((and files-only (not file)))
              ((string= name "*Buffer List*"))
--- 531,543 ----
                           list-buffers-directory)
                  (setq this-buffer-directory list-buffers-directory))))
            (cond
!             ;; Maybe don't mention internal buffers.
!             ((and (null list-internal-buffers)
!                   (equal (string-to-char name) ?\ ))
!             ;; Maybe mention only internal buffers.
!             ((and list-internal-buffers
!                   (not (eq list-internal-buffers t))
!                   (not (equal (string-to-char name) ?\ )))
              ;; Maybe don't mention buffers without files.
              ((and files-only (not file)))
              ((string= name "*Buffer List*"))

*** emacs-21.3/lisp/ebuff-menu.el~      Thu Aug 23 16:17:34 2001
--- emacs-21.3/lisp/ebuff-menu.el       Fri Oct  1 10:12:10 2004
***************
*** 39,45 ****
  (defvar electric-buffer-menu-mode-map nil)

  ;;;###autoload
! (defun electric-buffer-list (arg)
    "Pops up a buffer describing the set of Emacs buffers.
  Vaguely like ITS lunar select buffer; combining typeoutoid buffer
  listing with menuoid buffer selection.
--- 39,45 ----
  (defvar electric-buffer-menu-mode-map nil)

  ;;;###autoload
! (defun electric-buffer-list (&optional files-only)
    "Pops up a buffer describing the set of Emacs buffers.
  Vaguely like ITS lunar select buffer; combining typeoutoid buffer
  listing with menuoid buffer selection.
***************
*** 54,64 ****

  Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil.

  \\{electric-buffer-menu-mode-map}"
    (interactive "P")
    (let (select buffer)
      (save-window-excursion
!       (setq buffer (list-buffers-noselect arg))
        (Electric-pop-up-window buffer)
        (unwind-protect
          (progn
--- 54,68 ----

  Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil.

+ Note that buffers with names starting with spaces are omitted
+ unless `list-internal-buffers' is non-nil.
+ Non-null optional files-only FILES-ONLY means mention only file buffers.
+
  \\{electric-buffer-menu-mode-map}"
    (interactive "P")
    (let (select buffer)
      (save-window-excursion
!       (setq buffer (list-buffers-noselect files-only))
        (Electric-pop-up-window buffer)
        (unwind-protect
          (progn





reply via email to

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