unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page
@ 2012-05-04 17:04 Wolfgang Jenkner
  2012-05-06  4:19 ` Chong Yidong
  2012-05-06 13:57 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Wolfgang Jenkner @ 2012-05-04 17:04 UTC (permalink / raw)
  To: 11408

Look a the emacs(1) man page

M-x m a n <return> e m a c s <return>

You may (or may not, depending on how your man program outputs tab
characters) observe that the underlining of some words protrudes to the
following white space.  E.g., I see occurrences of "Emacs  windows" or
"Emacs.   Help" where the (multiple) space characters are underlined.

GNU Emacs 24.1.50.1 (amd64-unknown-freebsd9.0, GTK+ Version 2.24.6)
 of 2012-05-02 on iznogoud.viz


2012-05-04  Wolfgang Jenkner  <wjenkner@inode.at>

	* man.el (Man-unindent): Use text-property-default-nonsticky to
	prevent untabify from inheriting `face' text properties.
	In particular, underlined white space didn't look so hot.


=== modified file 'lisp/man.el'
--- lisp/man.el	2012-04-28 21:59:08 +0000
+++ lisp/man.el	2012-05-04 16:18:33 +0000
@@ -1475,7 +1475,12 @@
 	    (nindent 0))
 	(narrow-to-region (car page) (car (cdr page)))
 	(if Man-uses-untabify-flag
-	    (untabify (point-min) (point-max)))
+	    (let ((text-property-default-nonsticky
+		   ;; The space characters `untabify' (or rather `indent-to')
+		   ;; inserts inherit sticky text properties, which is
+		   ;; unnecessary and looks exceedingly ugly with `underline'.
+		   (cons '(face . t) text-property-default-nonsticky)))
+	      (untabify (point-min) (point-max))))
 	(if (catch 'unindent
 	      (goto-char (point-min))
 	      (if (not (re-search-forward Man-first-heading-regexp nil t))







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

* bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page
  2012-05-04 17:04 bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page Wolfgang Jenkner
@ 2012-05-06  4:19 ` Chong Yidong
  2012-05-06 13:57 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2012-05-06  4:19 UTC (permalink / raw)
  To: 11408

Wolfgang Jenkner <wjenkner@inode.at> writes:

> 2012-05-04  Wolfgang Jenkner  <wjenkner@inode.at>
>
> * man.el (Man-unindent): Use text-property-default-nonsticky to
> prevent untabify from inheriting `face' text properties.
> In particular, underlined white space didn't look so hot.

Thanks, committed to trunk.





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

* bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page
  2012-05-04 17:04 bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page Wolfgang Jenkner
  2012-05-06  4:19 ` Chong Yidong
@ 2012-05-06 13:57 ` Stefan Monnier
  2012-05-06 15:31   ` Wolfgang Jenkner
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-05-06 13:57 UTC (permalink / raw)
  To: 11408

> 	* man.el (Man-unindent): Use text-property-default-nonsticky to
> 	prevent untabify from inheriting `face' text properties.
> 	In particular, underlined white space didn't look so hot.

Thanks.  The BTW, I think this should be fixed in untabify.


        Stefan





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

* bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page
  2012-05-06 13:57 ` Stefan Monnier
@ 2012-05-06 15:31   ` Wolfgang Jenkner
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Jenkner @ 2012-05-06 15:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11408

On Sun, May 06 2012, Stefan Monnier wrote:

>> 	* man.el (Man-unindent): Use text-property-default-nonsticky to
>> 	prevent untabify from inheriting `face' text properties.
>> 	In particular, underlined white space didn't look so hot.
>
> Thanks.  The BTW, I think this should be fixed in untabify.

The following idea is perhaps obvious or silly or obviously silly,
but...

Here's a simple test

#+begin_src emacs-lisp
(with-temp-buffer
  (insert-string "foo\t\tbar")
  (put-text-property 1 4 'face 'underline)
  (put-text-property 4 6 'face '(:background "red"))
  (put-text-property 6 9 'face '(:foreground "blue"))
  (untabify (point-min) (point-max))
  (message "%s" (buffer-string)))
#+end_src

Wolfgang

diff --git a/lisp/tabify.el b/lisp/tabify.el
index 26762ac..6d27084 100644
--- a/lisp/tabify.el
+++ b/lisp/tabify.el
@@ -46,7 +46,9 @@ The variable `tab-width' controls the spacing of tab stops."
                 column)
             (skip-chars-forward "\t")
             (setq column (current-column))
-            (delete-region tab-beg (point))
+            ;; Inherit from the last tab in a run.
+            (insert-char ?\s 1 t)
+            (delete-region tab-beg (1- (point)))
             (indent-to column)))))
     (move-to-column c)))
 






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

end of thread, other threads:[~2012-05-06 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04 17:04 bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page Wolfgang Jenkner
2012-05-06  4:19 ` Chong Yidong
2012-05-06 13:57 ` Stefan Monnier
2012-05-06 15:31   ` Wolfgang Jenkner

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