Subject: bug#1779: 23.0.60; proced with variable-pitch header line

From: Stephen Berman <[email-masked]>
Date: Tue, 19 Jul 2011 23:24:26 +0200

On Fri, 15 Jul 2011 23:05:59 +0200 Stephen Berman <[email-masked]> wrote:

> On Fri, 15 Jul 2011 19:54:11 +0200 Lars Magne Ingebrigtsen <[email-masked]> wrote:
>
>> Stefan Monnier <[email-masked]> writes:
>>
>>> I guess lack of time.  I don't think I agree with the change to the face
>>> definition, but the part of the code that adds :align-to properties to
>>> the spaces looks fine.
>>
>> Stephen, could you send an updated patch with just the :align-to
>> properties?  (If that makes any sense.  :-)  I'm not familiar enough
>> with the code to know whether that would be an improvement or not
>> without the other bits in the patch.)
>
> Sure.  I'll do it as soon as I can, but I probably won't have time until
> Monday or Tuesday.

The patch is below.  The only change I made from the previous patch
(aside from leaving out the face change) is to omit the comment from
buff-menu.el about assuming fixed-pitch, since obviously we aren't
making that assumption (though it's true that :align-to works best with
fixed-pitch, but still I definitely think it's an improvement).

Steve Berman

*** /home/steve/bzr/emacs/trunk/lisp/proced.el	2011-07-08 15:13:26.000000000 +0200
--- /home/steve/bzr/emacs/quickfixes/lisp/proced.el	2011-07-19 23:06:48.000000000 +0200
***************
*** 1509,1514 ****
--- 1509,1524 ----
      (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
+      			     (list 'space :align-to pos)
+      			     header)))
      ;; (delete-trailing-whitespace)
      (goto-char (point-min))
      (while (re-search-forward "[ \t\r]+$" nil t)
***************
*** 1602,1608 ****
      (while (not (eobp))
        (insert "  ")
        (forward-line))
-     (setq proced-header-line (concat "  " proced-header-line))
      (if revert (set-buffer-modified-p nil))
  
      ;; set `goal-column'
--- 1612,1617 ----