aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2013-03-23 02:38:11 +0200
committerJuri Linkov2013-03-23 02:38:11 +0200
commite38e6780432ec53b3297354b04eb7ad8136dd358 (patch)
tree2d22d1d7bb4e8f897622e5bea6d25c38536686cf
parentb886708cc640958efcf6bd68ed1674af124a2565 (diff)
downloademacs-e38e6780432ec53b3297354b04eb7ad8136dd358.tar.gz
emacs-e38e6780432ec53b3297354b04eb7ad8136dd358.zip
* lisp/info.el (info-index-match): New face.
(Info-index, Info-apropos-matches): Add a nested subgroup to the main pattern and add text properties with the new face to matches in index entries relative to the beginning of the index entry. Fixes: debbugs:14015
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/info.el51
3 files changed, 45 insertions, 20 deletions
diff --git a/etc/NEWS b/etc/NEWS
index a4691f7f181..1947797bd34 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -174,6 +174,12 @@ When toggling, it restores the frame's previous window configuration.
174It also has an optional frame argument, which can be used by Lisp 174It also has an optional frame argument, which can be used by Lisp
175callers to fit the image to a frame other than the selected frame. 175callers to fit the image to a frame other than the selected frame.
176 176
177** Info
178
179*** New face `info-index-match' is used to highlight matches in index
180entries displayed by `Info-index-next', `Info-virtual-index' and
181`info-apropos'.
182
177** Isearch 183** Isearch
178 184
179*** `C-x 8 RET' in Isearch mode reads a character by its Unicode name 185*** `C-x 8 RET' in Isearch mode reads a character by its Unicode name
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1c955e303fb..966bbb1367c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12013-03-23 Juri Linkov <juri@jurta.org>
2
3 * info.el (info-index-match): New face.
4 (Info-index, Info-apropos-matches): Add a nested subgroup to the
5 main pattern and add text properties with the new face to matches
6 in index entries relative to the beginning of the index entry.
7 (Bug#14015)
8
12013-03-21 Eric Ludlam <zappo@gnu.org> 92013-03-21 Eric Ludlam <zappo@gnu.org>
2 10
3 * eieio/eieio-datadebug.el (data-debug/eieio-insert-slots): 11 * eieio/eieio-datadebug.el (data-debug/eieio-insert-slots):
diff --git a/lisp/info.el b/lisp/info.el
index 3586a124c14..4679b51b999 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -158,6 +158,12 @@ A header-line does not scroll with the rest of the buffer."
158 "Face for Info nodes in a node header." 158 "Face for Info nodes in a node header."
159 :group 'info) 159 :group 'info)
160 160
161(defface info-index-match
162 '((t :inherit match))
163 "Face used to highlight matches in an index entry."
164 :group 'info
165 :version "24.4")
166
161;; This is a defcustom largely so that we can get the benefit 167;; This is a defcustom largely so that we can get the benefit
162;; of custom-initialize-delay. Perhaps it would work to make it a 168;; of custom-initialize-delay. Perhaps it would work to make it a
163;; defvar and explicitly give it a standard-value property, and 169;; defvar and explicitly give it a standard-value property, and
@@ -3063,15 +3069,15 @@ The next cross-reference is searched using the regexp PAT, and the next link
3063is searched using the text property PROP. Move point to the closest found position 3069is searched using the text property PROP. Move point to the closest found position
3064of either a cross-reference found by `re-search-forward' or a link found by 3070of either a cross-reference found by `re-search-forward' or a link found by
3065`next-single-char-property-change'. Return the new position of point, or nil." 3071`next-single-char-property-change'. Return the new position of point, or nil."
3066 (let ((pcref (save-excursion (re-search-forward pat nil t))) 3072 (let ((pxref (save-excursion (re-search-forward pat nil t)))
3067 (plink (next-single-char-property-change (point) prop))) 3073 (plink (next-single-char-property-change (point) prop)))
3068 (when (and (< plink (point-max)) (not (get-char-property plink prop))) 3074 (when (and (< plink (point-max)) (not (get-char-property plink prop)))
3069 (setq plink (next-single-char-property-change plink prop))) 3075 (setq plink (next-single-char-property-change plink prop)))
3070 (if (< plink (point-max)) 3076 (if (< plink (point-max))
3071 (if (and pcref (<= pcref plink)) 3077 (if (and pxref (<= pxref plink))
3072 (goto-char (or (match-beginning 1) (match-beginning 0))) 3078 (goto-char (or (match-beginning 1) (match-beginning 0)))
3073 (goto-char plink)) 3079 (goto-char plink))
3074 (if pcref (goto-char (or (match-beginning 1) (match-beginning 0))))))) 3080 (if pxref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
3075 3081
3076(defun Info-prev-reference-or-link (pat prop) 3082(defun Info-prev-reference-or-link (pat prop)
3077 "Move point to the previous pattern-based cross-reference or property-based link. 3083 "Move point to the previous pattern-based cross-reference or property-based link.
@@ -3079,15 +3085,15 @@ The previous cross-reference is searched using the regexp PAT, and the previous
3079is searched using the text property PROP. Move point to the closest found position 3085is searched using the text property PROP. Move point to the closest found position
3080of either a cross-reference found by `re-search-backward' or a link found by 3086of either a cross-reference found by `re-search-backward' or a link found by
3081`previous-single-char-property-change'. Return the new position of point, or nil." 3087`previous-single-char-property-change'. Return the new position of point, or nil."
3082 (let ((pcref (save-excursion (re-search-backward pat nil t))) 3088 (let ((pxref (save-excursion (re-search-backward pat nil t)))
3083 (plink (previous-single-char-property-change (point) prop))) 3089 (plink (previous-single-char-property-change (point) prop)))
3084 (when (and (> plink (point-min)) (not (get-char-property plink prop))) 3090 (when (and (> plink (point-min)) (not (get-char-property plink prop)))
3085 (setq plink (previous-single-char-property-change plink prop))) 3091 (setq plink (previous-single-char-property-change plink prop)))
3086 (if (> plink (point-min)) 3092 (if (> plink (point-min))
3087 (if (and pcref (>= pcref plink)) 3093 (if (and pxref (>= pxref plink))
3088 (goto-char (or (match-beginning 1) (match-beginning 0))) 3094 (goto-char (or (match-beginning 1) (match-beginning 0)))
3089 (goto-char plink)) 3095 (goto-char plink))
3090 (if pcref (goto-char (or (match-beginning 1) (match-beginning 0))))))) 3096 (if pxref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
3091 3097
3092(defun Info-next-reference (&optional recur count) 3098(defun Info-next-reference (&optional recur count)
3093 "Move cursor to the next cross-reference or menu item in the node. 3099 "Move cursor to the next cross-reference or menu item in the node.
@@ -3276,7 +3282,7 @@ Give an empty topic name to go to the Index node itself."
3276 (= (aref topic 0) ?:)) 3282 (= (aref topic 0) ?:))
3277 (setq topic (substring topic 1))) 3283 (setq topic (substring topic 1)))
3278 (let ((orignode Info-current-node) 3284 (let ((orignode Info-current-node)
3279 (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" 3285 (pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
3280 (regexp-quote topic))) 3286 (regexp-quote topic)))
3281 node (nodes (Info-index-nodes)) 3287 node (nodes (Info-index-nodes))
3282 (ohist-list Info-history-list) 3288 (ohist-list Info-history-list)
@@ -3295,12 +3301,14 @@ Give an empty topic name to go to the Index node itself."
3295 (progn 3301 (progn
3296 (goto-char (point-min)) 3302 (goto-char (point-min))
3297 (while (re-search-forward pattern nil t) 3303 (while (re-search-forward pattern nil t)
3298 (push (list (match-string-no-properties 1) 3304 (let ((entry (match-string-no-properties 1))
3299 (match-string-no-properties 2) 3305 (nodename (match-string-no-properties 3))
3300 Info-current-node 3306 (line (string-to-number (concat "0" (match-string 4)))))
3301 (string-to-number (concat "0" 3307 (add-text-properties
3302 (match-string 3)))) 3308 (- (match-beginning 2) (match-beginning 1))
3303 matches)) 3309 (- (match-end 2) (match-beginning 1))
3310 '(face info-index-match) entry)
3311 (push (list entry nodename Info-current-node line) matches)))
3304 (setq nodes (cdr nodes) node (car nodes))) 3312 (setq nodes (cdr nodes) node (car nodes)))
3305 (Info-goto-node node)) 3313 (Info-goto-node node))
3306 (or matches 3314 (or matches
@@ -3526,7 +3534,7 @@ MATCHES is a list of index matches found by `Info-apropos-matches'.")
3526Return a list of matches where each element is in the format 3534Return a list of matches where each element is in the format
3527\((FILENAME INDEXTEXT NODENAME LINENUMBER))." 3535\((FILENAME INDEXTEXT NODENAME LINENUMBER))."
3528 (unless (string= string "") 3536 (unless (string= string "")
3529 (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" 3537 (let ((pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ \t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
3530 (regexp-quote string))) 3538 (regexp-quote string)))
3531 (ohist Info-history) 3539 (ohist Info-history)
3532 (ohist-list Info-history-list) 3540 (ohist-list Info-history-list)
@@ -3559,12 +3567,15 @@ Return a list of matches where each element is in the format
3559 (progn 3567 (progn
3560 (goto-char (point-min)) 3568 (goto-char (point-min))
3561 (while (re-search-forward pattern nil t) 3569 (while (re-search-forward pattern nil t)
3562 (setq matches 3570 (let ((entry (match-string-no-properties 1))
3563 (cons (list manual 3571 (nodename (match-string-no-properties 3))
3564 (match-string-no-properties 1) 3572 (line (match-string-no-properties 4)))
3565 (match-string-no-properties 2) 3573 (add-text-properties
3566 (match-string-no-properties 3)) 3574 (- (match-beginning 2) (match-beginning 1))
3567 matches))) 3575 (- (match-end 2) (match-beginning 1))
3576 '(face info-index-match) entry)
3577 (setq matches (cons (list manual entry nodename line)
3578 matches))))
3568 (setq nodes (cdr nodes) node (car nodes))) 3579 (setq nodes (cdr nodes) node (car nodes)))
3569 (Info-goto-node node)))) 3580 (Info-goto-node node))))
3570 (error 3581 (error