unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 1779@debbugs.gnu.org, 1779@emacsbugs.donarmstrong.com
Subject: bug#1779: 23.0.60; proced with variable-pitch header line
Date: Mon, 06 Dec 2010 00:30:17 +0100	[thread overview]
Message-ID: <877hfnajcm.fsf@escher.home> (raw)
In-Reply-To: <873afzcwdi.fsf@cyd.mit.edu> (Chong Yidong's message of "Sun, 04 Jan 2009 03:23:53 -0500")

On Sun, 04 Jan 2009 03:23:53 -0500 Chong Yidong <cyd@stupidchicken.com> wrote:

>> Proced does not align the attribute names in the header line with the
>> corresponding columns when header-line face has variable pitch.
>>
>> I know of two approaches to dealing with this situation in Emacs, namely
>> that of buff-menu.el and that of ibuffer.el.  The latter imposes a
>> fixed-pitch face in the header line, overriding the
>> user customization.  The former uses the display property with an
>> :align-to specification to get proper alignment.  Maybe one of these
>> will work with proced.el too.
>
> We can't use :align-to because proced justifies some headers to the
> right hand side of the column.

I (finally) took a look at this again and it appears that :align-to as
used in buff-menu.el with some additional tweaking pretty much DTRT
after all.  With my variable-pitch font (Dejavu Sans) I find the spacing
between "%CPU" and "%Mem" too crowded; using fixed-pitch looks better,
and that's what the attached patch does.  Alternatively, I think it
looks fine to let the header line font be variable-pitch as long as the
let-bound variable whitespace is set to two spaces.  I actually think
this makes the proced listings also more legible, though it does leave
less space for the process invocation listing and is also a departure
from the Dired display that Proced is modelled on.  Anyway, I'd be happy
with either approach; both are better than the current display when the
header-line face is variable-pitch.

Steve Berman


*** /data/steve/bzr/emacs/trunk/lisp/proced.el	2010-09-08 10:12:09.000000000 +0200
--- /data/steve/bzr/emacs/quickfixes/lisp/proced.el	2010-12-06 00:02:20.000000000 +0100
***************
*** 400,406 ****
    :group 'proced-faces)
  
  (defface proced-sort-header
!   '((t (:inherit font-lock-keyword-face)))
    "Face used for header of attribute used for sorting."
    :group 'proced-faces)
  
--- 400,406 ----
    :group 'proced-faces)
  
  (defface proced-sort-header
!   '((t (:family "Monospace" :inherit font-lock-keyword-face)))
    "Face used for header of attribute used for sorting."
    :group 'proced-faces)
  
***************
*** 1427,1433 ****
               (hprops
                (if (nth 4 grammar)
                    (let ((descend (if (eq key sort-key) proced-descend (nth 5 grammar))))
!                     `(proced-key ,key mouse-face highlight
                                   help-echo ,(format proced-header-help-echo
                                                      (if descend "-" "+")
                                                      (nth 1 grammar)
--- 1427,1433 ----
               (hprops
                (if (nth 4 grammar)
                    (let ((descend (if (eq key sort-key) proced-descend (nth 5 grammar))))
!                     `(proced-key ,key face fixed-pitch mouse-face highlight
                                   help-echo ,(format proced-header-help-echo
                                                      (if descend "-" "+")
                                                      (nth 1 grammar)
***************
*** 1509,1514 ****
--- 1509,1525 ----
      (if (string-match "[ \t]+$" proced-header-line)
          (setq proced-header-line (substring proced-header-line 0
                                              (match-beginning 0))))
+     (setq proced-header-line (concat "  " proced-header-line))
+     ;; From buff-menu.el: Turn whitespace chars in the header into stretch
+     ;; specs so they work regardless of the header-line face.
+     (let ((pos 0)
+     	  (header proced-header-line))
+     	(while (string-match "[ \t\n]+" header pos)
+     	  (setq pos (match-end 0))
+     	  (put-text-property (match-beginning 0) pos 'display
+     			     ;; Assume fixed-size chars in the buffer.
+     			     (list 'space :align-to pos)
+     			     header)))
      ;; (delete-trailing-whitespace)
      (goto-char (point-min))
      (while (re-search-forward "[ \t\r]+$" nil t)





  parent reply	other threads:[~2010-12-05 23:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-04  8:23 bug#1779: 23.0.60; proced with variable-pitch header line Chong Yidong
2009-01-04 15:01 ` Stephen Berman
2009-01-04 15:46   ` Stefan Monnier
2010-12-05 23:30 ` Stephen Berman [this message]
2010-12-07 10:40   ` Stephen Berman
2011-07-10 14:47     ` Lars Magne Ingebrigtsen
2011-07-11  3:36       ` Stefan Monnier
2011-07-15 17:54         ` Lars Magne Ingebrigtsen
2011-07-15 21:05           ` Stephen Berman
2011-07-19 21:24             ` Stephen Berman
2009-01-03 22:02               ` Stephen Berman
2011-07-20  1:18                 ` Roland Winkler
2011-07-20  8:28                   ` Stephen Berman
2011-07-20  9:54                     ` Lars Magne Ingebrigtsen
2020-10-11 22:22                       ` Stefan Monnier
2020-10-11 22:50                         ` Stephen Berman
2021-11-22 17:40                         ` Juri Linkov
2021-11-24  6:53                           ` Lars Ingebrigtsen
2021-11-24  9:15                             ` Juri Linkov
2021-11-24 16:51                               ` Lars Ingebrigtsen
2021-11-24 18:51                                 ` bug#1779: [External] : " Drew Adams
2021-11-29 17:16                                 ` Juri Linkov
2021-11-29 18:05                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-29 18:47                                     ` Lars Ingebrigtsen
2021-11-29 18:55                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2011-07-20 11:56                     ` Roland Winkler
2011-07-21 16:41                       ` Chong Yidong
2011-07-22  3:03                         ` Roland Winkler
2011-07-22  5:15                           ` Chong Yidong
2022-04-24 14:00                 ` Lars Ingebrigtsen
2011-07-19 21:31               ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877hfnajcm.fsf@escher.home \
    --to=stephen.berman@gmx.net \
    --cc=1779@debbugs.gnu.org \
    --cc=1779@emacsbugs.donarmstrong.com \
    --cc=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).