emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112111: * lisp/info.el (info-index-m


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112111: * lisp/info.el (info-index-match): New face.
Date: Sat, 23 Mar 2013 02:38:11 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112111
fixes bug: http://debbugs.gnu.org/14015
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Sat 2013-03-23 02:38:11 +0200
message:
  * 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.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/info.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-03-12 02:08:21 +0000
+++ b/etc/NEWS  2013-03-23 00:38:11 +0000
@@ -174,6 +174,12 @@
 It also has an optional frame argument, which can be used by Lisp
 callers to fit the image to a frame other than the selected frame.
 
+** Info
+
+*** New face `info-index-match' is used to highlight matches in index
+entries displayed by `Info-index-next', `Info-virtual-index' and
+`info-apropos'.
+
 ** Isearch
 
 *** `C-x 8 RET' in Isearch mode reads a character by its Unicode name

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-22 19:31:15 +0000
+++ b/lisp/ChangeLog    2013-03-23 00:38:11 +0000
@@ -1,3 +1,11 @@
+2013-03-23  Juri Linkov  <address@hidden>
+
+       * 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.
+       (Bug#14015)
+
 2013-03-21  Eric Ludlam  <address@hidden>
 
        * eieio/eieio-datadebug.el (data-debug/eieio-insert-slots):

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2013-03-20 23:04:40 +0000
+++ b/lisp/info.el      2013-03-23 00:38:11 +0000
@@ -158,6 +158,12 @@
   "Face for Info nodes in a node header."
   :group 'info)
 
+(defface info-index-match
+  '((t :inherit match))
+  "Face used to highlight matches in an index entry."
+  :group 'info
+  :version "24.4")
+
 ;; This is a defcustom largely so that we can get the benefit
 ;; of custom-initialize-delay.  Perhaps it would work to make it a
 ;; defvar and explicitly give it a standard-value property, and
@@ -3063,15 +3069,15 @@
 is searched using the text property PROP.  Move point to the closest found 
position
 of either a cross-reference found by `re-search-forward' or a link found by
 `next-single-char-property-change'.  Return the new position of point, or nil."
-  (let ((pcref (save-excursion (re-search-forward pat nil t)))
+  (let ((pxref (save-excursion (re-search-forward pat nil t)))
        (plink (next-single-char-property-change (point) prop)))
     (when (and (< plink (point-max)) (not (get-char-property plink prop)))
       (setq plink (next-single-char-property-change plink prop)))
     (if (< plink (point-max))
-       (if (and pcref (<= pcref plink))
+       (if (and pxref (<= pxref plink))
            (goto-char (or (match-beginning 1) (match-beginning 0)))
          (goto-char plink))
-      (if pcref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
+      (if pxref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
 
 (defun Info-prev-reference-or-link (pat prop)
   "Move point to the previous pattern-based cross-reference or property-based 
link.
@@ -3079,15 +3085,15 @@
 is searched using the text property PROP.  Move point to the closest found 
position
 of either a cross-reference found by `re-search-backward' or a link found by
 `previous-single-char-property-change'.  Return the new position of point, or 
nil."
-  (let ((pcref (save-excursion (re-search-backward pat nil t)))
+  (let ((pxref (save-excursion (re-search-backward pat nil t)))
        (plink (previous-single-char-property-change (point) prop)))
     (when (and (> plink (point-min)) (not (get-char-property plink prop)))
       (setq plink (previous-single-char-property-change plink prop)))
     (if (> plink (point-min))
-       (if (and pcref (>= pcref plink))
+       (if (and pxref (>= pxref plink))
            (goto-char (or (match-beginning 1) (match-beginning 0)))
          (goto-char plink))
-      (if pcref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
+      (if pxref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
 
 (defun Info-next-reference (&optional recur count)
   "Move cursor to the next cross-reference or menu item in the node.
@@ -3276,7 +3282,7 @@
           (= (aref topic 0) ?:))
       (setq topic (substring topic 1)))
   (let ((orignode Info-current-node)
-       (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ 
\t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
+       (pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ 
\t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
                         (regexp-quote topic)))
        node (nodes (Info-index-nodes))
        (ohist-list Info-history-list)
@@ -3295,12 +3301,14 @@
              (progn
                (goto-char (point-min))
                (while (re-search-forward pattern nil t)
-                 (push (list (match-string-no-properties 1)
-                             (match-string-no-properties 2)
-                             Info-current-node
-                             (string-to-number (concat "0"
-                                                       (match-string 3))))
-                       matches))
+                 (let ((entry (match-string-no-properties 1))
+                       (nodename (match-string-no-properties 3))
+                       (line (string-to-number (concat "0" (match-string 4)))))
+                   (add-text-properties
+                    (- (match-beginning 2) (match-beginning 1))
+                    (- (match-end 2) (match-beginning 1))
+                    '(face info-index-match) entry)
+                   (push (list entry nodename Info-current-node line) 
matches)))
                (setq nodes (cdr nodes) node (car nodes)))
            (Info-goto-node node))
          (or matches
@@ -3526,7 +3534,7 @@
 Return a list of matches where each element is in the format
 \((FILENAME INDEXTEXT NODENAME LINENUMBER))."
   (unless (string= string "")
-    (let ((pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ 
\t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
+    (let ((pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ 
\t]+\\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
                           (regexp-quote string)))
          (ohist Info-history)
          (ohist-list Info-history-list)
@@ -3559,12 +3567,15 @@
                         (progn
                           (goto-char (point-min))
                           (while (re-search-forward pattern nil t)
-                           (setq matches
-                                 (cons (list manual
-                                             (match-string-no-properties 1)
-                                             (match-string-no-properties 2)
-                                             (match-string-no-properties 3))
-                                       matches)))
+                           (let ((entry (match-string-no-properties 1))
+                                 (nodename (match-string-no-properties 3))
+                                 (line (match-string-no-properties 4)))
+                             (add-text-properties
+                              (- (match-beginning 2) (match-beginning 1))
+                              (- (match-end 2) (match-beginning 1))
+                              '(face info-index-match) entry)
+                             (setq matches (cons (list manual entry nodename 
line)
+                                                 matches))))
                           (setq nodes (cdr nodes) node (car nodes)))
                       (Info-goto-node node))))
            (error


reply via email to

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