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

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

bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man


From: Wolfgang Jenkner
Subject: bug#11408: 24.1.50; [PATCH] Don't inherit faces when untabifying the man page
Date: Sun, 06 May 2012 17:31:38 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (berkeley-unix)

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






reply via email to

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