unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ibuffer as default
@ 2003-03-10 23:28 Stefan Monnier
  2003-03-11  7:47 ` John Paul Wallington
  2003-03-11 18:36 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2003-03-10 23:28 UTC (permalink / raw)



Hadn't it been decided to make Ibuffer the default (i.e. replacing
list-buffers) ?  Did I dream it ?
Also I see that list-buffers uses the header-line whereas Ibuffer
doesn't.  But I also note that the header-line doesn't look right
(I think it doesn't take into account the width taken up by the
scrollbar and it doesn't use the default face so the things
don't line up neatly).


	Stefan


PS: Turns out the header-line problem is that:
    - my header-line face uses a different font than my default face
      which makes it hard to line things up.  Adding a `face default'
      property to the string solves the lining-up but overrides the
      general look of the header-line (grey background with a slight
      3d look).
    - list-buffers-noselect calculates the spacing necessary for the
      scrollbar+fringe for the current frame which in my case was the
      minibuffer-only frame, leading to a result that's wrong for
      the frame that is ultimately used to display the buffer.

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

* Re: Ibuffer as default
  2003-03-10 23:28 Ibuffer as default Stefan Monnier
@ 2003-03-11  7:47 ` John Paul Wallington
  2003-03-11  8:49   ` Miles Bader
  2003-03-11 18:36 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: John Paul Wallington @ 2003-03-11  7:47 UTC (permalink / raw)
  Cc: emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> wrote:

> Hadn't it been decided to make Ibuffer the default (i.e. replacing
> list-buffers) ?  Did I dream it ?

Colin told me that making Ibuffer the default was contingent upon it
taking less space or consing less.

> Also I see that list-buffers uses the header-line whereas Ibuffer
> doesn't.

Ibuffer does use the header-line, but for displaying what filters
(not filter groups) are active.

>  But I also note that the header-line doesn't look right
> (I think it doesn't take into account the width taken up by the
> scrollbar and it doesn't use the default face so the things
> don't line up neatly).
>
>
> 	Stefan
>
>
> PS: Turns out the header-line problem is that:
>     - my header-line face uses a different font than my default face
>       which makes it hard to line things up.  Adding a `face default'
>       property to the string solves the lining-up but overrides the
>       general look of the header-line (grey background with a slight
>       3d look).
>     - list-buffers-noselect calculates the spacing necessary for the
>       scrollbar+fringe for the current frame which in my case was the
>       minibuffer-only frame, leading to a result that's wrong for
>       the frame that is ultimately used to display the buffer.

I recently changed it to work better, especially for relatively
default cases like emacs -nw and Emacs under X with a left-sided
scrollbar and left-sided fringe (before it just used one space char
regardless).  But it seems doomed to lose given unusual settings.  Is
there a straight-forward way to cons up pixel-perfect spacing, say as
a display property ?

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

* Re: Ibuffer as default
  2003-03-11  7:47 ` John Paul Wallington
@ 2003-03-11  8:49   ` Miles Bader
  2003-03-11 19:13     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Miles Bader @ 2003-03-11  8:49 UTC (permalink / raw)
  Cc: Stefan Monnier

John Paul Wallington <jpw@gnu.org> writes:
> I recently changed it to work better, especially for relatively
> default cases like emacs -nw and Emacs under X with a left-sided
> scrollbar and left-sided fringe (before it just used one space char
> regardless).  But it seems doomed to lose given unusual settings.  Is
> there a straight-forward way to cons up pixel-perfect spacing, say as
> a display property ?

Yeah, given the popularity of using it for showing aligned stuff, there
definitively should at least be an option for the header-line to start
exactly at the text's left edge.  This could even be something as simple
as a boolean variable I think, or a magic `%' escape in
header-line-format.

Stefan's problem (different font) seems a lot harder though...

-Miles
-- 
o The existentialist, not having a pillow, goes everywhere with the book by
  Sullivan, _I am going to spit on your graves_.

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

* Re: Ibuffer as default
  2003-03-10 23:28 Ibuffer as default Stefan Monnier
  2003-03-11  7:47 ` John Paul Wallington
@ 2003-03-11 18:36 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2003-03-11 18:36 UTC (permalink / raw)
  Cc: emacs-devel

    Hadn't it been decided to make Ibuffer the default (i.e. replacing
    list-buffers) ?  Did I dream it ?

I don't we decided to do this.  I was thinking about it, but Ibuffer
is so BIG.

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

* Re: Ibuffer as default
  2003-03-11  8:49   ` Miles Bader
@ 2003-03-11 19:13     ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2003-03-11 19:13 UTC (permalink / raw)
  Cc: Stefan Monnier

> > I recently changed it to work better, especially for relatively
> > default cases like emacs -nw and Emacs under X with a left-sided
> > scrollbar and left-sided fringe (before it just used one space char
> > regardless).  But it seems doomed to lose given unusual settings.  Is
> > there a straight-forward way to cons up pixel-perfect spacing, say as
> > a display property ?
> 
> Yeah, given the popularity of using it for showing aligned stuff, there
> definitively should at least be an option for the header-line to start
> exactly at the text's left edge.  This could even be something as simple
> as a boolean variable I think, or a magic `%' escape in
> header-line-format.

Agreed.
BTW, I suspect that the `spaces' calculation should ideally
be enhanced to take into account window margins rather than only
scrollbars and fringes.... clearly this is a nightmare and should
be solved in a cleaner way.

> Stefan's problem (different font) seems a lot harder though...

How 'bout the patch below ?
Note that it doesn't address the problem of the leading space
being different in different frames and that it wouldn't be
able to use a % magic thingy either.


	Stefan


--- buff-menu.el.~1.60.~	Mon Mar 10 17:59:02 2003
+++ buff-menu.el	Mon Mar 10 18:49:43 2003
@@ -547,6 +547,9 @@
 		       ? )
 	  size))
 
+(defvar Buffer-menu-header-line nil)
+(put 'Buffer-menu-header-line 'risky-local-variable t)
+
 (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*'.
@@ -557,9 +560,31 @@
   (let* ((old-buffer (current-buffer))
 	 (standard-output standard-output)
 	 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
-	 (header (concat "CRM " (Buffer-menu-buffer+size "Buffer" "Size")
+	 (header (concat (propertize "CRM " 'face 'fixed-pitch)
+			 (Buffer-menu-buffer+size "Buffer" "Size")
 			 "  Mode" mode-end "File\n"))
 	 list desired-point name file mode)
+    (when Buffer-menu-use-header-line
+      (let ((spaces
+	     (/ (+ 0.0 (or (frame-parameter nil 'left-fringe) 0)
+		   (or (if (eq (frame-parameter nil 'vertical-scroll-bars)
+			       'left)
+			   (frame-parameter nil 'scroll-bar-width))
+		       0))
+		(frame-char-width)))
+	    (pos 0))
+	;; Turn spaces in the header into stretch specs so they work
+	;; regardless of the header-line face.
+	(while (string-match "[ \t]+" header pos)
+	  (setq pos (match-end 0))
+	  (put-text-property (match-beginning 0) pos 'display
+			     ;; Assume fixed-size chars
+			     (list 'space :align-to (+ spaces pos))
+			     header))
+	;; Add the leading space
+	(setq header (concat (propertize (make-string (floor spaces) ? )
+					 'display (list 'space :width spaces))
+			     header))))
     (save-excursion
       (set-buffer (get-buffer-create "*Buffer List*"))
       (setq buffer-read-only nil)
@@ -639,15 +664,7 @@
 	(princ "\n"))
       (Buffer-menu-mode)
       (when Buffer-menu-use-header-line
-	(let ((spaces
-	       (/ (+ (or (frame-parameter nil 'left-fringe) 0)
-		     (or (if (eq (frame-parameter nil 'vertical-scroll-bars)
-				 'left)
-			     (frame-parameter nil 'scroll-bar-width))
-			 0))
-		  (frame-char-width))))
-	  (set (make-local-variable 'Buffer-menu-header-line)
-	       (concat (make-string spaces ? ) header)))
+	(set (make-local-variable 'Buffer-menu-header-line) header)
 	(setq header-line-format 'Buffer-menu-header-line))
       ;; DESIRED-POINT doesn't have to be set; it is not when the
       ;; current buffer is not displayed for some reason.

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

end of thread, other threads:[~2003-03-11 19:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-10 23:28 Ibuffer as default Stefan Monnier
2003-03-11  7:47 ` John Paul Wallington
2003-03-11  8:49   ` Miles Bader
2003-03-11 19:13     ` Stefan Monnier
2003-03-11 18:36 ` Richard Stallman

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