emacs-devel
[Top][All Lists]
Advanced

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

Re: 3 dots vanish at end of filled line


From: Luc Teirlinck
Subject: Re: 3 dots vanish at end of filled line
Date: Mon, 10 Oct 2005 22:31:46 -0500 (CDT)

   Indeed.  And we've been through this discussion already.  And since Emacs's
   Info mode does even more of those "dangerous" guessing games now than
   before, I think it's pretty clear that we've decided it's worth the risk.

For other types of abuse of the Info format by info.el, at least
customizable variables were provided to get around them.  The patch
below provides such a variable.

   If those risks are too high for you, then I'd suggest you turn off font-lock
   in your info buffers.

I do not want to turn off font-lock entirely, only the part of it that
I consider reckless and senseless: the games played with the titles.
There is for example nothing wrong with Font Lock fontifying links
because if Font Lock gets confused about them, then probably info.el
is confused and will incorrectly try to follow them or fail to follow
then and hence there is a bug to be fixed.

I still believe that it would be a lot better not to mess with mode
titles in the middle of a node.  If I would not be able to convince
people of that then I believe that we need a customizable variable
allowing people to turn the processing of titles off without having to
give up on fontification of links and menus.

If fontification of titles in the body of a node would not be disabled
by default then I believe that it makes more sense to make the new
variable turn off fontification for all titles, even the node titles,
as people who explicitly customize it probably are not going to worry
about the fact that this constitutes a change from previous Emacs
versions.  They are more typically going to worry about uniformity of
style between the different ways of reading Info: Emacs under X,
emacs -nw and the standalone Info reader.

The patch below would provide a customizable variable allowing to turn
the processing of titles off entirely or partially (only the hiding
part).  The present situation would remain the default, although I
personally still believe that this is a mistake. 

If I could convince people that it is better not to process titles in
the middle of a node, then I would provide a fourth option disabling
processing of titles only in the body of a node and make that the default.

As usual, I can install if desired.

===File ~/info.el-diff======================================
*** info.el     04 Oct 2005 09:11:27 -0500      1.448
--- info.el     10 Oct 2005 20:05:52 -0500      
***************
*** 3626,3631 ****
--- 3626,3647 ----
      keymap)
    "Keymap to put on the Up link in the text or the header line.")
  
+ (defcustom Info-fontify-titles t
+   "If non-nil fontify titles in Info nodes.
+ This uses the faces `info-title-1' through `info-title-4'.
+ If the value is t, also hide the underlining.
+ If nil, leave the titles exactly as in the .info files.  This makes
+ the titles look like they do in the standalone Info reader.
+ If neither nil not t, fontify the titles, but do not hide the underlining,
+ The latter option looks bad with the default values of `info-title-1'
+ and friends, so if you choose it, you will probably also want to customize
+ those faces."
+   :type '(choice (const :tag "Fontify and hide underlining" t)
+                (const :tag "Fontify but do not hide underlining" 'no-hiding)
+                (const :tag "Neither fontify nor hide" nil))
+   :group 'info
+   :version "22.1")
+ 
  (defun Info-fontify-node ()
    "Fontify the node."
    (save-excursion
***************
*** 3700,3723 ****
                (put-text-property (point) header-end 'invisible t)))))
  
        ;; Fontify titles
!       (goto-char (point-min))
!       (when not-fontified-p
!         (while (re-search-forward "\n\\([^ 
\t\n].+\\)\n\\(\\*\\*+\\|==+\\|--+\\|\\.\\.+\\)$"
!                                   nil t)
!           (let* ((c (preceding-char))
!                  (face
!                   (cond ((= c ?*) 'info-title-1)
!                         ((= c ?=) 'info-title-2)
!                         ((= c ?-) 'info-title-3)
!                         (t        'info-title-4))))
!             (put-text-property (match-beginning 1) (match-end 1)
!                                'font-lock-face face))
!           ;; This is a serious problem for trying to handle multiple
!           ;; frame types at once.  We want this text to be invisible
!           ;; on frames that can display the font above.
!           (when (memq (framep (selected-frame)) '(x pc w32 mac))
!             (add-text-properties (1- (match-beginning 2)) (match-end 2)
!                                  '(invisible t front-sticky nil 
rear-nonsticky t)))))
  
        ;; Fontify cross references
        (goto-char (point-min))
--- 3716,3741 ----
                (put-text-property (point) header-end 'invisible t)))))
  
        ;; Fontify titles
!       (when Info-fontify-titles
!       (goto-char (point-min))
!       (when not-fontified-p
!         (while (re-search-forward "\n\\([^ 
\t\n].+\\)\n\\(\\*\\*+\\|==+\\|--+\\|\\.\\.+\\)$"
!                                   nil t)
!           (let* ((c (preceding-char))
!                  (face
!                   (cond ((= c ?*) 'info-title-1)
!                         ((= c ?=) 'info-title-2)
!                         ((= c ?-) 'info-title-3)
!                         (t        'info-title-4))))
!             (put-text-property (match-beginning 1) (match-end 1)
!                                'font-lock-face face))
!           ;; This is a serious problem for trying to handle multiple
!           ;; frame types at once.  We want this text to be invisible
!           ;; on frames that can display the font above.
!           (and (memq (framep (selected-frame)) '(x pc w32 mac))
!                (eq Info-fontify-titles t)
!                (add-text-properties (1- (match-beginning 2)) (match-end 2)
!                                     '(invisible t front-sticky nil 
rear-nonsticky t))))))
  
        ;; Fontify cross references
        (goto-char (point-min))
============================================================




reply via email to

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