aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-04-10 23:31:17 +0000
committerRichard M. Stallman2005-04-10 23:31:17 +0000
commit1ecc5922df5ede77b13a23d1189c6d7e477a608a (patch)
treee1b3b5b677930764d4d49f19b632c704625cddb9
parent819555b068cbaff9fc62b2adf1397e2129cdea82 (diff)
downloademacs-1ecc5922df5ede77b13a23d1189c6d7e477a608a.tar.gz
emacs-1ecc5922df5ede77b13a23d1189c6d7e477a608a.zip
(Info-fontify-node): Handle fontification of multiple * Menu lines in one node.
-rw-r--r--lisp/info.el141
1 files changed, 71 insertions, 70 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 81494a167bb..3ded620cb7a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3799,77 +3799,78 @@ Preserve text properties."
3799 (let ((n 0) 3799 (let ((n 0)
3800 cont) 3800 cont)
3801 (while (re-search-forward 3801 (while (re-search-forward
3802 (concat "^\\* +\\(" Info-menu-entry-name-re "\\)\\(:" 3802 (concat "^\\* Menu:\\|\\(?:^\\* +\\(" Info-menu-entry-name-re "\\)\\(:"
3803 Info-node-spec-re "\\([ \t]*\\)\\)") 3803 Info-node-spec-re "\\([ \t]*\\)\\)\\)")
3804 nil t) 3804 nil t)
3805 (when not-fontified-p 3805 (when (match-beginning 1)
3806 (setq n (1+ n)) 3806 (when not-fontified-p
3807 (if (and (<= n 9) (zerop (% n 3))) ; visual aids to help with 1-9 keys 3807 (setq n (1+ n))
3808 (put-text-property (match-beginning 0) 3808 (if (and (<= n 9) (zerop (% n 3))) ; visual aids to help with 1-9 keys
3809 (1+ (match-beginning 0)) 3809 (put-text-property (match-beginning 0)
3810 'font-lock-face 'info-menu-5))) 3810 (1+ (match-beginning 0))
3811 (when not-fontified-p 3811 'font-lock-face 'info-menu-5)))
3812 (add-text-properties 3812 (when not-fontified-p
3813 (match-beginning 1) (match-end 1) 3813 (add-text-properties
3814 (list 3814 (match-beginning 1) (match-end 1)
3815 'help-echo (if (and (match-end 3) 3815 (list
3816 (not (equal (match-string 3) ""))) 3816 'help-echo (if (and (match-end 3)
3817 (concat "mouse-2: go to " (match-string 3)) 3817 (not (equal (match-string 3) "")))
3818 "mouse-2: go to this node") 3818 (concat "mouse-2: go to " (match-string 3))
3819 'mouse-face 'highlight))) 3819 "mouse-2: go to this node")
3820 (when (or not-fontified-p fontify-visited-p) 3820 'mouse-face 'highlight)))
3821 (add-text-properties 3821 (when (or not-fontified-p fontify-visited-p)
3822 (match-beginning 1) (match-end 1) 3822 (add-text-properties
3823 (list 3823 (match-beginning 1) (match-end 1)
3824 'font-lock-face 3824 (list
3825 ;; Display visited menu items in a different face 3825 'font-lock-face
3826 (if (and Info-fontify-visited-nodes 3826 ;; Display visited menu items in a different face
3827 (save-match-data 3827 (if (and Info-fontify-visited-nodes
3828 (let ((node (if (equal (match-string 3) "") 3828 (save-match-data
3829 (match-string 1) 3829 (let ((node (if (equal (match-string 3) "")
3830 (match-string 3))) 3830 (match-string 1)
3831 (file (file-name-nondirectory Info-current-file)) 3831 (match-string 3)))
3832 (hl Info-history-list) 3832 (file (file-name-nondirectory Info-current-file))
3833 res) 3833 (hl Info-history-list)
3834 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) 3834 res)
3835 (setq file (file-name-nondirectory 3835 (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
3836 (match-string 1 node)) 3836 (setq file (file-name-nondirectory
3837 node (if (equal (match-string 2 node) "") 3837 (match-string 1 node))
3838 "Top" 3838 node (if (equal (match-string 2 node) "")
3839 (match-string 2 node)))) 3839 "Top"
3840 (while hl 3840 (match-string 2 node))))
3841 (if (and (string-equal node (nth 1 (car hl))) 3841 (while hl
3842 (string-equal file 3842 (if (and (string-equal node (nth 1 (car hl)))
3843 (file-name-nondirectory 3843 (string-equal file
3844 (nth 0 (car hl))))) 3844 (file-name-nondirectory
3845 (setq res (car hl) hl nil) 3845 (nth 0 (car hl)))))
3846 (setq hl (cdr hl)))) 3846 (setq res (car hl) hl nil)
3847 res))) 'info-xref-visited 'info-xref)))) 3847 (setq hl (cdr hl))))
3848 (when (and not-fontified-p (memq Info-hide-note-references '(t hide))) 3848 res))) 'info-xref-visited 'info-xref))))
3849 (put-text-property (match-beginning 2) (1- (match-end 6)) 3849 (when (and not-fontified-p (memq Info-hide-note-references '(t hide)))
3850 'invisible t) 3850 (put-text-property (match-beginning 2) (1- (match-end 6))
3851 ;; Unhide the file name in parens 3851 'invisible t)
3852 (if (and (match-end 4) (not (eq (char-after (match-end 4)) ?.))) 3852 ;; Unhide the file name in parens
3853 (remove-text-properties (match-beginning 4) (match-end 4) 3853 (if (and (match-end 4) (not (eq (char-after (match-end 4)) ?.)))
3854 '(invisible t))) 3854 (remove-text-properties (match-beginning 4) (match-end 4)
3855 ;; We need a stretchable space like :align-to but with 3855 '(invisible t)))
3856 ;; a minimum value. 3856 ;; We need a stretchable space like :align-to but with
3857 (put-text-property (1- (match-end 6)) (match-end 6) 'display 3857 ;; a minimum value.
3858 (if (>= 22 (- (match-end 1) 3858 (put-text-property (1- (match-end 6)) (match-end 6) 'display
3859 (match-beginning 0))) 3859 (if (>= 22 (- (match-end 1)
3860 '(space :align-to 24) 3860 (match-beginning 0)))
3861 '(space :width 2))) 3861 '(space :align-to 24)
3862 (setq cont (looking-at ".")) 3862 '(space :width 2)))
3863 (while (and (= (forward-line 1) 0) 3863 (setq cont (looking-at "."))
3864 (looking-at "\\([ \t]+\\)[^*\n]")) 3864 (while (and (= (forward-line 1) 0)
3865 (put-text-property (match-beginning 1) (1- (match-end 1)) 3865 (looking-at "\\([ \t]+\\)[^*\n]"))
3866 'invisible t) 3866 (put-text-property (match-beginning 1) (1- (match-end 1))
3867 (put-text-property (1- (match-end 1)) (match-end 1) 3867 'invisible t)
3868 'display 3868 (put-text-property (1- (match-end 1)) (match-end 1)
3869 (if cont 3869 'display
3870 '(space :align-to 26) 3870 (if cont
3871 '(space :align-to 24))) 3871 '(space :align-to 26)
3872 (setq cont t)))))) 3872 '(space :align-to 24)))
3873 (setq cont t)))))))
3873 3874
3874 ;; Fontify menu headers 3875 ;; Fontify menu headers
3875 ;; Add the face `info-menu-header' to any header before a menu entry 3876 ;; Add the face `info-menu-header' to any header before a menu entry