aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKenichi Handa2013-03-22 00:21:20 +0900
committerKenichi Handa2013-03-22 00:21:20 +0900
commit022039da8ea1166498c507dda4944afd9c49c9fe (patch)
treef6fef85c61f1483cadf977775b7f99c98f63514b /lisp
parent8bc369d4a23a3a8040d77e3ce89a7f63b1ecff97 (diff)
parentafff09d015b0e17c059e68fe4a8f1d31014a3700 (diff)
downloademacs-022039da8ea1166498c507dda4944afd9c49c9fe.tar.gz
emacs-022039da8ea1166498c507dda4944afd9c49c9fe.zip
merge trunk
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/info.el77
-rw-r--r--lisp/mouse.el3
-rw-r--r--lisp/subr.el19
4 files changed, 99 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 392cc9ac2fa..f0427753551 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12013-03-20 Juri Linkov <juri@jurta.org>
2
3 * info.el (Info-next-reference-or-link)
4 (Info-prev-reference-or-link): New functions.
5 (Info-next-reference, Info-prev-reference): Use them.
6 (Info-try-follow-nearest-node): Handle footnote navigation.
7 (Info-fontify-node): Fontify footnotes. (Bug#13989)
8
92013-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
10
11 * subr.el (posn-point, posn-string): Fix it here instead (bug#13979).
12 * mouse.el (mouse-on-link-p): Undo scroll-bar fix.
13
12013-03-20 Paul Eggert <eggert@cs.ucla.edu> 142013-03-20 Paul Eggert <eggert@cs.ucla.edu>
2 15
3 Suppress unnecessary non-ASCII chatter during build process. 16 Suppress unnecessary non-ASCII chatter during build process.
@@ -15,8 +28,8 @@
15 28
16 * whitespace.el (whitespace-font-lock, whitespace-font-lock-mode): 29 * whitespace.el (whitespace-font-lock, whitespace-font-lock-mode):
17 Remove vars. 30 Remove vars.
18 (whitespace-color-on, whitespace-color-off): Use 31 (whitespace-color-on, whitespace-color-off):
19 `font-lock-fontify-buffer' (Bug#13817). 32 Use `font-lock-fontify-buffer' (Bug#13817).
20 33
212013-03-19 Stefan Monnier <monnier@iro.umontreal.ca> 342013-03-19 Stefan Monnier <monnier@iro.umontreal.ca>
22 35
@@ -76,8 +89,7 @@
76 buffer's first char. Use `with-selected-window' instead of 89 buffer's first char. Use `with-selected-window' instead of
77 `save-window-excursion' with `select-window'. 90 `save-window-excursion' with `select-window'.
78 (doc-view-document->bitmap): Check the current doc-view overlay's 91 (doc-view-document->bitmap): Check the current doc-view overlay's
79 display property instead the char property of the buffer's first 92 display property instead the char property of the buffer's first char.
80 char.
81 93
822013-03-18 Paul Eggert <eggert@cs.ucla.edu> 942013-03-18 Paul Eggert <eggert@cs.ucla.edu>
83 95
diff --git a/lisp/info.el b/lisp/info.el
index 3792857d47a..3586a124c14 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3057,6 +3057,38 @@ See `Info-scroll-down'."
3057 (select-window (posn-window (event-start e)))) 3057 (select-window (posn-window (event-start e))))
3058 (Info-scroll-down))) 3058 (Info-scroll-down)))
3059 3059
3060(defun Info-next-reference-or-link (pat prop)
3061 "Move point to the next pattern-based cross-reference or property-based link.
3062The 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
3064of 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."
3066 (let ((pcref (save-excursion (re-search-forward pat nil t)))
3067 (plink (next-single-char-property-change (point) prop)))
3068 (when (and (< plink (point-max)) (not (get-char-property plink prop)))
3069 (setq plink (next-single-char-property-change plink prop)))
3070 (if (< plink (point-max))
3071 (if (and pcref (<= pcref plink))
3072 (goto-char (or (match-beginning 1) (match-beginning 0)))
3073 (goto-char plink))
3074 (if pcref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
3075
3076(defun Info-prev-reference-or-link (pat prop)
3077 "Move point to the previous pattern-based cross-reference or property-based link.
3078The previous cross-reference is searched using the regexp PAT, and the previous link
3079is 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
3081`previous-single-char-property-change'. Return the new position of point, or nil."
3082 (let ((pcref (save-excursion (re-search-backward pat nil t)))
3083 (plink (previous-single-char-property-change (point) prop)))
3084 (when (and (> plink (point-min)) (not (get-char-property plink prop)))
3085 (setq plink (previous-single-char-property-change plink prop)))
3086 (if (> plink (point-min))
3087 (if (and pcref (>= pcref plink))
3088 (goto-char (or (match-beginning 1) (match-beginning 0)))
3089 (goto-char plink))
3090 (if pcref (goto-char (or (match-beginning 1) (match-beginning 0)))))))
3091
3060(defun Info-next-reference (&optional recur count) 3092(defun Info-next-reference (&optional recur count)
3061 "Move cursor to the next cross-reference or menu item in the node. 3093 "Move cursor to the next cross-reference or menu item in the node.
3062If COUNT is non-nil (interactively with a prefix arg), jump over 3094If COUNT is non-nil (interactively with a prefix arg), jump over
@@ -3071,14 +3103,13 @@ COUNT cross-references."
3071 (old-pt (point)) 3103 (old-pt (point))
3072 (case-fold-search t)) 3104 (case-fold-search t))
3073 (or (eobp) (forward-char 1)) 3105 (or (eobp) (forward-char 1))
3074 (or (re-search-forward pat nil t) 3106 (or (Info-next-reference-or-link pat 'link)
3075 (progn 3107 (progn
3076 (goto-char (point-min)) 3108 (goto-char (point-min))
3077 (or (re-search-forward pat nil t) 3109 (or (Info-next-reference-or-link pat 'link)
3078 (progn 3110 (progn
3079 (goto-char old-pt) 3111 (goto-char old-pt)
3080 (user-error "No cross references in this node"))))) 3112 (user-error "No cross references in this node")))))
3081 (goto-char (or (match-beginning 1) (match-beginning 0)))
3082 (if (looking-at "\\* Menu:") 3113 (if (looking-at "\\* Menu:")
3083 (if recur 3114 (if recur
3084 (user-error "No cross references in this node") 3115 (user-error "No cross references in this node")
@@ -3099,14 +3130,13 @@ COUNT cross-references."
3099 (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://") 3130 (let ((pat "\\*note[ \n\t]+\\([^:]+\\):\\|^\\* .*:\\|[hf]t?tps?://")
3100 (old-pt (point)) 3131 (old-pt (point))
3101 (case-fold-search t)) 3132 (case-fold-search t))
3102 (or (re-search-backward pat nil t) 3133 (or (Info-prev-reference-or-link pat 'link)
3103 (progn 3134 (progn
3104 (goto-char (point-max)) 3135 (goto-char (point-max))
3105 (or (re-search-backward pat nil t) 3136 (or (Info-prev-reference-or-link pat 'link)
3106 (progn 3137 (progn
3107 (goto-char old-pt) 3138 (goto-char old-pt)
3108 (user-error "No cross references in this node"))))) 3139 (user-error "No cross references in this node")))))
3109 (goto-char (or (match-beginning 1) (match-beginning 0)))
3110 (if (looking-at "\\* Menu:") 3140 (if (looking-at "\\* Menu:")
3111 (if recur 3141 (if recur
3112 (user-error "No cross references in this node") 3142 (user-error "No cross references in this node")
@@ -3840,7 +3870,25 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
3840 ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)")) 3870 ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
3841 (Info-goto-node "Top" fork)) 3871 (Info-goto-node "Top" fork))
3842 ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)")) 3872 ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
3843 (Info-goto-node node fork))) 3873 (Info-goto-node node fork))
3874 ;; footnote
3875 ((setq node (Info-get-token (point) "(" "\\(([0-9]+)\\)"))
3876 (let ((old-point (point)) new-point)
3877 (save-excursion
3878 (goto-char (point-min))
3879 (when (re-search-forward "^[ \t]*-+ Footnotes -+$" nil t)
3880 (setq new-point (if (< old-point (point))
3881 ;; Go to footnote reference
3882 (and (search-forward node nil t)
3883 ;; Put point at beginning of link
3884 (match-beginning 0))
3885 ;; Go to footnote definition
3886 (search-backward node nil t)))))
3887 (if new-point
3888 (progn
3889 (goto-char new-point)
3890 (setq node t))
3891 (setq node nil)))))
3844 node)) 3892 node))
3845 3893
3846(defun Info-mouse-follow-link (click) 3894(defun Info-mouse-follow-link (click)
@@ -4896,6 +4944,21 @@ first line or header line, and for breadcrumb links.")
4896 mouse-face highlight 4944 mouse-face highlight
4897 help-echo "mouse-2: go to this URL")))) 4945 help-echo "mouse-2: go to this URL"))))
4898 4946
4947 ;; Fontify footnotes
4948 (goto-char (point-min))
4949 (when (and not-fontified-p (re-search-forward "^[ \t]*-+ Footnotes -+$" nil t))
4950 (let ((limit (point)))
4951 (goto-char (point-min))
4952 (while (re-search-forward "\\(([0-9]+)\\)" nil t)
4953 (add-text-properties (match-beginning 0) (match-end 0)
4954 `(font-lock-face info-xref
4955 link t
4956 mouse-face highlight
4957 help-echo
4958 ,(if (< (point) limit)
4959 "mouse-2: go to footnote definition"
4960 "mouse-2: go to footnote reference"))))))
4961
4899 ;; Hide empty lines at the end of the node. 4962 ;; Hide empty lines at the end of the node.
4900 (goto-char (point-max)) 4963 (goto-char (point-max))
4901 (skip-chars-backward "\n") 4964 (skip-chars-backward "\n")
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 333a1cef703..0367cad87b8 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -759,8 +759,7 @@ click is the local or global binding of that event.
759- Otherwise, the mouse-1 event is translated into a mouse-2 event 759- Otherwise, the mouse-1 event is translated into a mouse-2 event
760at the same position." 760at the same position."
761 (let ((action 761 (let ((action
762 (and (not (memq 'vertical-scroll-bar pos)) 762 (and (or (not (consp pos))
763 (or (not (consp pos))
764 mouse-1-click-in-non-selected-windows 763 mouse-1-click-in-non-selected-windows
765 (eq (selected-window) (posn-window pos))) 764 (eq (selected-window) (posn-window pos)))
766 (or (mouse-posn-property pos 'follow-link) 765 (or (mouse-posn-property pos 'follow-link)
diff --git a/lisp/subr.el b/lisp/subr.el
index 9a7b94208fe..4eb46ec2b01 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1044,14 +1044,17 @@ and `event-end' functions."
1044 (nth 1 position)))) 1044 (nth 1 position))))
1045 (and (symbolp area) area))) 1045 (and (symbolp area) area)))
1046 1046
1047(defsubst posn-point (position) 1047(defun posn-point (position)
1048 "Return the buffer location in POSITION. 1048 "Return the buffer location in POSITION.
1049POSITION should be a list of the form returned by the `event-start' 1049POSITION should be a list of the form returned by the `event-start'
1050and `event-end' functions." 1050and `event-end' functions.
1051Returns nil if POSITION does not correspond to any buffer location (e.g.
1052a click on a scroll bar)."
1051 (or (nth 5 position) 1053 (or (nth 5 position)
1052 (if (consp (nth 1 position)) 1054 (let ((pt (nth 1 position)))
1053 (car (nth 1 position)) 1055 (or (car-safe pt)
1054 (nth 1 position)))) 1056 ;; Apparently this can also be `vertical-scroll-bar' (bug#13979).
1057 (if (integerp pt) pt)))))
1055 1058
1056(defun posn-set-point (position) 1059(defun posn-set-point (position)
1057 "Move point to POSITION. 1060 "Move point to POSITION.
@@ -1124,12 +1127,14 @@ POSITION should be a list of the form returned by the `event-start'
1124and `event-end' functions." 1127and `event-end' functions."
1125 (nth 3 position)) 1128 (nth 3 position))
1126 1129
1127(defsubst posn-string (position) 1130(defun posn-string (position)
1128 "Return the string object of POSITION. 1131 "Return the string object of POSITION.
1129Value is a cons (STRING . STRING-POS), or nil if not a string. 1132Value is a cons (STRING . STRING-POS), or nil if not a string.
1130POSITION should be a list of the form returned by the `event-start' 1133POSITION should be a list of the form returned by the `event-start'
1131and `event-end' functions." 1134and `event-end' functions."
1132 (nth 4 position)) 1135 (let ((x (nth 4 position)))
1136 ;; Apparently this can also be `handle' or `below-handle' (bug#13979).
1137 (when (consp x) x)))
1133 1138
1134(defsubst posn-image (position) 1139(defsubst posn-image (position)
1135 "Return the image object of POSITION. 1140 "Return the image object of POSITION.