aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2006-02-24 08:08:56 +0000
committerMiles Bader2006-02-24 08:08:56 +0000
commit5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6 (patch)
tree94e98550d534fbb93def22ee0d458518ebe6c7f1 /lisp
parente2a3e3535794bf99969d8f93018a85f4d8678c3d (diff)
parent5f4264e54bb59b9b0590a113fbd015c3c0920f7a (diff)
downloademacs-5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6.tar.gz
emacs-5432dcf9e0da4e2c38dee53fbe8423ff5f06bed6.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-23
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 113-118) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 38-39) - Update from CVS
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog138
-rw-r--r--lisp/allout.el22
-rw-r--r--lisp/compare-w.el25
-rw-r--r--lisp/ediff-diff.el5
-rw-r--r--lisp/gnus/ChangeLog37
-rw-r--r--lisp/gnus/flow-fill.el10
-rw-r--r--lisp/gnus/message.el4
-rw-r--r--lisp/gnus/mm-util.el4
-rw-r--r--lisp/gnus/mm-view.el9
-rw-r--r--lisp/gnus/nnimap.el1
-rw-r--r--lisp/gnus/qp.el2
-rw-r--r--lisp/gnus/utf7.el2
-rw-r--r--lisp/help.el10
-rw-r--r--lisp/info.el12
-rw-r--r--lisp/progmodes/gdb-ui.el110
-rw-r--r--lisp/progmodes/glasses.el14
-rw-r--r--lisp/progmodes/gud.el15
-rw-r--r--lisp/textmodes/org.el804
-rw-r--r--lisp/textmodes/reftex-auc.el2
-rw-r--r--lisp/textmodes/reftex-cite.el2
-rw-r--r--lisp/textmodes/reftex-dcr.el108
-rw-r--r--lisp/textmodes/reftex-global.el2
-rw-r--r--lisp/textmodes/reftex-index.el2
-rw-r--r--lisp/textmodes/reftex-parse.el2
-rw-r--r--lisp/textmodes/reftex-ref.el2
-rw-r--r--lisp/textmodes/reftex-sel.el2
-rw-r--r--lisp/textmodes/reftex-toc.el2
-rw-r--r--lisp/textmodes/reftex-vars.el14
-rw-r--r--lisp/textmodes/reftex.el36
29 files changed, 1103 insertions, 295 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6b91115cd67..8101c48f10b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,135 @@
12006-02-24 Juanma Barranquero <lekktu@gmail.com>
2
3 * help.el (help): Revert last part of 2006-02-23 change (deletion
4 of the `provide' call).
5
62006-02-23 Juri Linkov <juri@jurta.org>
7
8 * compare-w.el (compare-windows-highlight): Add new value
9 `persistent' and change :type from `boolean' to `choice'.
10 (compare-windows-overlays1, compare-windows-overlays2):
11 New internal variables.
12 (compare-windows-highlight): If compare-windows-highlight is
13 `persistent', add current overlays to compare-windows-overlays[12]
14 instead of adding compare-windows-dehighlight to pre-command-hook.
15 (compare-windows-dehighlight): Delete all overlays from
16 compare-windows-overlays[12].
17
18 * info.el (Info-search): Don't bind search-spaces-regexp to
19 Info-search-whitespace-regexp in non-regexp isearch mode.
20
212006-02-23 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * help.el (describe-mode): Pass `mode-name' to format-mode-line.
24
252006-02-23 Juanma Barranquero <lekktu@gmail.com>
26
27 * textmodes/org.el (org-xemacs-p)
28 (org-export-html-show-new-buffer, org-table-may-need-update)
29 (org-insert-item, org-mhe-get-message-real-folder)
30 (org-mhe-get-message-folder-from-index)
31 (org-mhe-get-message-folder, org-mhe-get-message-num)
32 (org-mhe-get-header, org-make-org-heading-search-string)
33 (org-make-org-heading-camel, org-table-sort-lines)
34 (org-format-org-table-html, org-format-table-table-html):
35 Fix typos in docstrings.
36
3712006-02-23 Carsten Dominik <dominik@science.uva.nl>
38
39 * textmodes/org.el (org-cleaned-string-for-export)
40 (org-solidify-link-text): New function.
41 (org-add-hook): Use `add-local-hook' instead of `make-local-hook' for
42 XEmacs, just to silence the compiler.
43 (org-export-as-ascii, org-export-as-html-and-open):
44 Use `org-cleaned-string-for-export' and create internal links.
45 (org-follow-mhe-link): Require mh-e, use folder.
46
472006-02-23 Nick Roberts <nickrob@snap.net.nz>
48
49 * progmodes/gud.el (gud-speedbar-buttons): Use shadow face properly.
50
51 * progmodes/gdb-ui.el (gdb-debug-ring-max): Rename from
52 gdb-debug-log-length.
53 (gdb-debug-ring): Rename from gdb-debug-log-ring. Don't make
54 it a real ring but...
55 (gud-gdba-marker-filter): ...make it work like mark-ring.
56 (gdb-enable-debug): Rename from gdb-enable-debug-log.
57 (gdb-mouse-jump): New function. Add bindings.
58
592006-02-23 Nick Roberts <nickrob@snap.net.nz>
60
61 * progmodes/gdb-ui.el (gdb-signalled): New variable and function.
62 (gdb-debug-log-ring): Rename from gdb-debug-log and make a ring.
63 (gdb-send, gdb-send-item, gud-gdba-marker-filter): Use it.
64 (gdb-debug-log-length): Customize it's length.
65 (gud-watch, gdb-var-create-handler): Display function::var format
66 but don't use to create variable object.
67 (gdb-var-create-handler): Use message-box in place of message.
68 (gdb-stopped): Call gdb-exited if signalled.
69
702006-02-22 Carsten Dominik <dominik@science.uva.nl>
71
72 * textmodes/reftex.el (reftex-locate-file): Remove duplicate function.
73
74 * textmodes/reftex-vars.el (reftex-try-all-extensions): New option.
75
76 * textmodes/reftex.el (reftex-locate-file): Search all extensions
77 if `reftex-try-all-extensions' is set.
78
79 * textmodes/org.el (org-mark-ring-push, org-mark-ring-goto):
80 New commands.
81 (org-mark-ring): New variable.
82 (org-mark-ring-length): New option.
83 (org-open-at-point, org-goto, org-open-file): Push old position
84 onto the mark ring.
85 (org-add-hook): New function.
86 (org-export-table-remove-special-lines): New option.
87 (org-skip-comments, org-format-org-table-html): Respect new
88 option `org-export-table-remove-special-lines'.
89 (org-open-file): Allow special command configuration for
90 directory link.
91 (org-file-apps): Fix bugs in customize type, added setting
92 for directories.
93 (org-activate-tags, org-format-agenda-item, org-complete)
94 (org-get-tags-at, org-scan-tags, org-make-tags-matcher)
95 (org-get-tags, org-get-buffer-tags, org-open-at-point)
96 (org-link-search, org-make-org-heading-search-string)
97 (org-make-org-heading-camel): Allow @ and 0-9 as tags characters.
98 (org-radio-targets, org-file-link-context-use-camel-case)
99 (org-activate-camels): New options.
100 (org-update-radio-target-regexp, org-all-targets)
101 (org-make-target-link-regexp, org-activate-target-links):
102 New functions.
103 (org-make-org-heading-search-string): New function.
104 (org-store-link, org-insert-link): Use new option
105 `org-file-link-context-use-camel-case'.
106 (org-activate-camels): Use new option `org-activate-camels'.
107 (org-link-regexp): Add mhe prefix.
108 (org-open-at-point, org-store-link): Support for mhe links.
109 (org-mhe-get-message-real-folder, org-mhe-get-message-folder)
110 (org-mhe-get-message-folder-from-index, org-mhe-get-message-num)
111 (org-mhe-get-header, org-follow-mhe-link): New functions.
112 (org-remove-angle-brackets, org-add-angle-brackets):
113 New functions.
114 (org-bracket-link-regexp): New constant.
115 (org-read-date): Fix bug that was rejecting all typed dates.
116 (org-link-search): Make hierarchy above visible after a match.
117 (org-follow-bbdb-link): Inhibit electric mode for BBDB.
118 (org-store-link): Fix bug with link creation when cursor is in
119 an empty line.
120 (org-open-at-point): Fix bug with matching a link.
121 Fixed buggy argument sequence in call to `org-view-tags'.
122 (org-compile-prefix-format): Set `org-prefix-has-tag'.
123 (org-prefix-has-tag): New variable.
124 (org-format-agenda-item): Remove tags from headline
125 if appropriate.
126 (org-agenda-remove-tags-when-in-prefix): New option.
127
1282006-02-21 Michael Kifer <kifer@cs.stonybrook.edu>
129
130 * ediff-diff.el (ediff-setup-diff-regions, ediff-setup-diff-regions3):
131 Fix the regular expressions.
132
12006-02-21 Richard M. Stallman <rms@gnu.org> 1332006-02-21 Richard M. Stallman <rms@gnu.org>
2 134
3 * progmodes/sh-script.el (sh-mode): Set shell type based on file name 135 * progmodes/sh-script.el (sh-mode): Set shell type based on file name
@@ -49,8 +181,8 @@
49 181
502006-02-20 Chong Yidong <cyd@stupidchicken.com> 1822006-02-20 Chong Yidong <cyd@stupidchicken.com>
51 183
52 * custom.el (customize-mark-to-save, customize-mark-as-set): Load 184 * custom.el (customize-mark-to-save, customize-mark-as-set):
53 the symbol first. 185 Load the symbol first.
54 186
552006-02-20 Juanma Barranquero <lekktu@gmail.com> 1872006-02-20 Juanma Barranquero <lekktu@gmail.com>
56 188
@@ -163,7 +295,7 @@
163 * progmodes/gdb-ui.el (gdb-var-evaluate-expression-handler) 295 * progmodes/gdb-ui.el (gdb-var-evaluate-expression-handler)
164 (gdb-var-update-handler): Detect out of scope variables with pre 296 (gdb-var-update-handler): Detect out of scope variables with pre
165 GDB 6.4 too. 297 GDB 6.4 too.
166 (gdb-post-prompt): Revert changet 2006-02-17 (force update). 298 (gdb-post-prompt): Revert change from 2006-02-17 (force update).
167 Reset status of variable objects to nil in update handlers. 299 Reset status of variable objects to nil in update handlers.
168 (gdb-var-update-handler-1): Detect when a variable object comes 300 (gdb-var-update-handler-1): Detect when a variable object comes
169 in scope. setcar on var changes gdb-var-list directly. 301 in scope. setcar on var changes gdb-var-list directly.
diff --git a/lisp/allout.el b/lisp/allout.el
index 69d72506fce..edce1e8d61e 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1,7 +1,7 @@
1;;; allout.el --- extensive outline mode for use alone and with other modes 1;;; allout.el --- extensive outline mode for use alone and with other modes
2 2
3;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004, 3;; Copyright (C) 1992, 1993, 1994, 2001, 2002, 2003, 2004,
4;; 2005 Free Software Foundation, Inc. 4;; 2005, 2006 Free Software Foundation, Inc.
5 5
6;; Author: Ken Manheimer <ken dot manheimer at gmail dot com> 6;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
7;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com> 7;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
@@ -5811,14 +5811,14 @@ the point does not move. To ignore field boundaries bind
5811(provide 'allout) 5811(provide 'allout)
5812 5812
5813;;;_* Local emacs vars. 5813;;;_* Local emacs vars.
5814;;; The following `allout-layout' local variable setting: 5814;; The following `allout-layout' local variable setting:
5815;;; - closes all topics from the first topic to just before the third-to-last, 5815;; - closes all topics from the first topic to just before the third-to-last,
5816;;; - shows the children of the third to last (config vars) 5816;; - shows the children of the third to last (config vars)
5817;;; - and the second to last (code section), 5817;; - and the second to last (code section),
5818;;; - and closes the last topic (this local-variables section). 5818;; - and closes the last topic (this local-variables section).
5819;;;Local variables: 5819;;Local variables:
5820;;;allout-layout: (0 : -1 -1 0) 5820;;allout-layout: (0 : -1 -1 0)
5821;;;End: 5821;;End:
5822 5822
5823;;; arch-tag: cf38fbc3-c044-450f-8bff-afed8ba5681c 5823;; arch-tag: cf38fbc3-c044-450f-8bff-afed8ba5681c
5824;;; allout.el ends here 5824;;; allout.el ends here
diff --git a/lisp/compare-w.el b/lisp/compare-w.el
index 2d23de8c54c..e61f24a0c7c 100644
--- a/lisp/compare-w.el
+++ b/lisp/compare-w.el
@@ -117,8 +117,14 @@ and the value `((4) (4))' for horizontally split windows."
117 :version "22.1") 117 :version "22.1")
118 118
119(defcustom compare-windows-highlight t 119(defcustom compare-windows-highlight t
120 "*Non-nil means compare-windows highlights the differences." 120 "*Non-nil means compare-windows highlights the differences.
121 :type 'boolean 121The value t removes highlighting immediately after invoking a command
122other than `compare-windows'.
123The value `persistent' leaves all highlighted differences. You can clear
124out all highlighting later with the command `compare-windows-dehighlight'."
125 :type '(choice (const :tag "No highlighting" nil)
126 (const :tag "Persistent highlighting" persistent)
127 (other :tag "Highlight until next command" t))
122 :group 'compare-w 128 :group 'compare-w
123 :version "22.1") 129 :version "22.1")
124 130
@@ -130,6 +136,8 @@ and the value `((4) (4))' for horizontally split windows."
130 136
131(defvar compare-windows-overlay1 nil) 137(defvar compare-windows-overlay1 nil)
132(defvar compare-windows-overlay2 nil) 138(defvar compare-windows-overlay2 nil)
139(defvar compare-windows-overlays1 nil)
140(defvar compare-windows-overlays2 nil)
133(defvar compare-windows-sync-point nil) 141(defvar compare-windows-sync-point nil)
134 142
135;;;###autoload 143;;;###autoload
@@ -351,13 +359,22 @@ on third call it again advances points to the next difference and so on."
351 (overlay-put compare-windows-overlay2 'face 'compare-windows) 359 (overlay-put compare-windows-overlay2 'face 'compare-windows)
352 (overlay-put compare-windows-overlay2 'priority 1000)) 360 (overlay-put compare-windows-overlay2 'priority 1000))
353 (overlay-put compare-windows-overlay2 'window w2) 361 (overlay-put compare-windows-overlay2 'window w2)
354 ;; Remove highlighting before next command is executed 362 (if (not (eq compare-windows-highlight 'persistent))
355 (add-hook 'pre-command-hook 'compare-windows-dehighlight))) 363 ;; Remove highlighting before next command is executed
364 (add-hook 'pre-command-hook 'compare-windows-dehighlight)
365 (when compare-windows-overlay1
366 (push (copy-overlay compare-windows-overlay1) compare-windows-overlays1)
367 (delete-overlay compare-windows-overlay1))
368 (when compare-windows-overlay2
369 (push (copy-overlay compare-windows-overlay2) compare-windows-overlays2)
370 (delete-overlay compare-windows-overlay2)))))
356 371
357(defun compare-windows-dehighlight () 372(defun compare-windows-dehighlight ()
358 "Remove highlighting created by `compare-windows-highlight'." 373 "Remove highlighting created by `compare-windows-highlight'."
359 (interactive) 374 (interactive)
360 (remove-hook 'pre-command-hook 'compare-windows-dehighlight) 375 (remove-hook 'pre-command-hook 'compare-windows-dehighlight)
376 (mapc 'delete-overlay compare-windows-overlays1)
377 (mapc 'delete-overlay compare-windows-overlays2)
361 (and compare-windows-overlay1 (delete-overlay compare-windows-overlay1)) 378 (and compare-windows-overlay1 (delete-overlay compare-windows-overlay1))
362 (and compare-windows-overlay2 (delete-overlay compare-windows-overlay2))) 379 (and compare-windows-overlay2 (delete-overlay compare-windows-overlay2)))
363 380
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 62a6386584e..013ed9073db 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -251,7 +251,8 @@ one optional arguments, diff-number to refine.")
251;; ediff-setup-diff-regions3, which takes 4 arguments. 251;; ediff-setup-diff-regions3, which takes 4 arguments.
252(defun ediff-setup-diff-regions (file-A file-B file-C) 252(defun ediff-setup-diff-regions (file-A file-B file-C)
253 ;; looking for '-c', '-i', or a 'c', 'i' among clustered non-long options 253 ;; looking for '-c', '-i', or a 'c', 'i' among clustered non-long options
254 (if (string-match "^-[ci]\\| -[ci]\\|-[^- ]+[ci]" ediff-diff-options) 254 (if (string-match "^-[ci]\\| -[ci]\\|\\(^\\| \\)-[^- ]+[ci]"
255 ediff-diff-options)
255 (error "Options `-c' and `-i' are not allowed in `ediff-diff-options'")) 256 (error "Options `-c' and `-i' are not allowed in `ediff-diff-options'"))
256 257
257 ;; create, if it doesn't exist 258 ;; create, if it doesn't exist
@@ -1215,7 +1216,7 @@ delimiter regions"))
1215;; or it is the ancestor file. 1216;; or it is the ancestor file.
1216(defun ediff-setup-diff-regions3 (file-A file-B file-C) 1217(defun ediff-setup-diff-regions3 (file-A file-B file-C)
1217 ;; looking for '-i' or a 'i' among clustered non-long options 1218 ;; looking for '-i' or a 'i' among clustered non-long options
1218 (if (string-match "^-i\\| -i\\|-[^- ]+i" ediff-diff-options) 1219 (if (string-match "^-i\\| -i\\|\\(^\\| \\)-[^- ]+i" ediff-diff-options)
1219 (error "Option `-i' is not allowed in `ediff-diff3-options'")) 1220 (error "Option `-i' is not allowed in `ediff-diff3-options'"))
1220 1221
1221 (or (ediff-buffer-live-p ediff-diff-buffer) 1222 (or (ediff-buffer-live-p ediff-diff-buffer)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c77c92d05c7..87327dde482 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,38 @@
12006-02-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * flow-fill.el (fill-flowed): Bind adaptive-fill-mode to nil.
4 Remove space stuffing, and only do quotes that actually start with
5 ">" at the beginning of the lines.
6 Merge of 2005-11-17 and 2004-07-25 from the trunk.
7
82006-02-23 Reiner Steib <Reiner.Steib@gmx.de>
9
10 * utf7.el (utf7-utf-16-coding-system): Fix comment. utf-16-be is
11 also available in Emacs 21.3.
12
13 * message.el (message-fix-before-sending): Change "Emacs 22" to
14 "Emacs 23 (unicode)" in comment.
15
16 * qp.el (quoted-printable-encode-region): Change "Emacs 22" to
17 "Emacs 23 (unicode)" in comment.
18
19 * mm-util.el: Change "Emacs 22" to "Emacs 23 (unicode)" in
20 comment.
21 (mm-coding-system-p): Add comment about no-MULE XEmacs.
22
23 * mm-view.el (mm-fill-flowed): Add :version.
24
252006-02-23 Ralf Angeli <angeli@iwi.uni-sb.de>
26
27 * mm-view.el (mm-fill-flowed): New variable.
28 (mm-inline-text): Use it.
29
302006-02-21 Wolfram Fenske <wolfram.fenske@student.uni-magdeburg.de>
31 (tiny change)
32
33 * nnimap.el (nnimap-request-move-article): Change folder back to
34 source group before deleting.
35
12006-02-20 Katsumi Yamaoka <yamaoka@jpl.org> 362006-02-20 Katsumi Yamaoka <yamaoka@jpl.org>
2 37
3 * rfc2047.el (rfc2047-charset-to-coding-system): Don't check the 38 * rfc2047.el (rfc2047-charset-to-coding-system): Don't check the
@@ -1266,7 +1301,7 @@
1266 1301
1267 * gnus-topic.el (gnus-topic-mode): Ditto. 1302 * gnus-topic.el (gnus-topic-mode): Ditto.
1268 1303
12692005-07-08 Ralf Angeli <angeli@iwi.uni-sb.de> (tiny change) 13042005-07-08 Ralf Angeli <angeli@iwi.uni-sb.de>
1270 1305
1271 * gnus-art.el (gnus-article-next-page, gnus-article-next-page-1) 1306 * gnus-art.el (gnus-article-next-page, gnus-article-next-page-1)
1272 (gnus-article-prev-page): Take scroll-margin into consideration. 1307 (gnus-article-prev-page): Take scroll-margin into consideration.
diff --git a/lisp/gnus/flow-fill.el b/lisp/gnus/flow-fill.el
index c3f7f7bb20e..480505549c9 100644
--- a/lisp/gnus/flow-fill.el
+++ b/lisp/gnus/flow-fill.el
@@ -113,10 +113,15 @@ RFC 2646 suggests 66 characters for readability."
113 (save-excursion 113 (save-excursion
114 (set-buffer (or (current-buffer) buffer)) 114 (set-buffer (or (current-buffer) buffer))
115 (goto-char (point-min)) 115 (goto-char (point-min))
116 ;; Remove space stuffing.
117 (while (re-search-forward "^ " nil t)
118 (delete-char -1)
119 (forward-line 1))
120 (goto-char (point-min))
116 (while (re-search-forward " $" nil t) 121 (while (re-search-forward " $" nil t)
117 (when (save-excursion 122 (when (save-excursion
118 (beginning-of-line) 123 (beginning-of-line)
119 (looking-at "^\\(>*\\)\\( ?\\)")) 124 (looking-at "^\\(>+\\)\\( ?\\)"))
120 (let ((quote (match-string 1)) 125 (let ((quote (match-string 1))
121 sig) 126 sig)
122 (if (string= quote "") 127 (if (string= quote "")
@@ -146,7 +151,8 @@ RFC 2646 suggests 66 characters for readability."
146 (condition-case nil 151 (condition-case nil
147 (let ((fill-prefix (when quote (concat quote " "))) 152 (let ((fill-prefix (when quote (concat quote " ")))
148 (fill-column (eval fill-flowed-display-column)) 153 (fill-column (eval fill-flowed-display-column))
149 filladapt-mode) 154 filladapt-mode
155 adaptive-fill-mode)
150 (fill-region (fill-flowed-point-at-bol) 156 (fill-region (fill-flowed-point-at-bol)
151 (min (1+ (fill-flowed-point-at-eol)) 157 (min (1+ (fill-flowed-point-at-eol))
152 (point-max)) 158 (point-max))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index cf0dc5ea6fe..1bdc2f6a11f 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -3615,8 +3615,8 @@ It should typically alter the sending method in some way or other."
3615 (when (let ((char (char-after))) 3615 (when (let ((char (char-after)))
3616 (or (< (mm-char-int char) 128) 3616 (or (< (mm-char-int char) 128)
3617 (and (mm-multibyte-p) 3617 (and (mm-multibyte-p)
3618 ;; Fixme: Wrong for Emacs 23 and for things 3618 ;; FIXME: Wrong for Emacs 23 (unicode) and for
3619 ;; like undectable utf-8. Should at least 3619 ;; things like undecable utf-8. Should at least
3620 ;; use find-coding-systems-region. 3620 ;; use find-coding-systems-region.
3621 (memq (char-charset char) 3621 (memq (char-charset char)
3622 '(eight-bit-control eight-bit-graphic 3622 '(eight-bit-control eight-bit-graphic
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index 804a5b2294c..efb5aeef082 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -174,7 +174,7 @@ system object in XEmacs."
174 (if (fboundp 'coding-system-p) 174 (if (fboundp 'coding-system-p)
175 (when (coding-system-p cs) 175 (when (coding-system-p cs)
176 cs) 176 cs)
177 ;; Is this branch ever actually useful? 177 ;; no-MULE XEmacs:
178 (car (memq cs (mm-get-coding-system-list)))))) 178 (car (memq cs (mm-get-coding-system-list))))))
179 179
180(defvar mm-charset-synonym-alist 180(defvar mm-charset-synonym-alist
@@ -331,7 +331,7 @@ with Mule charsets. It is completely useless for Emacs."
331 cs mime mule alist) 331 cs mime mule alist)
332 (while css 332 (while css
333 (setq cs (pop css) 333 (setq cs (pop css)
334 mime (or (coding-system-get cs :mime-charset) ; Emacs 23 334 mime (or (coding-system-get cs :mime-charset); Emacs 23 (unicode)
335 (coding-system-get cs 'mime-charset))) 335 (coding-system-get cs 'mime-charset)))
336 (when (and mime 336 (when (and mime
337 (not (eq t (setq mule 337 (not (eq t (setq mule
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 43d6bddf194..c2b4e19f806 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -72,6 +72,12 @@
72 (html2text html2text)) 72 (html2text html2text))
73 "The attributes of washer types for text/html.") 73 "The attributes of washer types for text/html.")
74 74
75(defcustom mm-fill-flowed t
76 "If non-nil an format=flowed article will be displayed flowed."
77 :type 'boolean
78 :version "22.1"
79 :group 'mime-display)
80
75;;; Internal variables. 81;;; Internal variables.
76 82
77;;; 83;;;
@@ -407,7 +413,8 @@
407 (mm-insert-part handle) 413 (mm-insert-part handle)
408 (goto-char (point-max))) 414 (goto-char (point-max)))
409 (insert (mm-decode-string (mm-get-part handle) charset))) 415 (insert (mm-decode-string (mm-get-part handle) charset)))
410 (when (and (equal type "plain") 416 (when (and mm-fill-flowed
417 (equal type "plain")
411 (equal (cdr (assoc 'format (mm-handle-type handle))) 418 (equal (cdr (assoc 'format (mm-handle-type handle)))
412 "flowed")) 419 "flowed"))
413 (save-restriction 420 (save-restriction
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 26c0f8901ee..3c05b3713ea 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1492,6 +1492,7 @@ function is generally only called when Gnus is shutting down."
1492 (setq result (eval accept-form)) 1492 (setq result (eval accept-form))
1493 (kill-buffer buf) 1493 (kill-buffer buf)
1494 result) 1494 result)
1495 (nnimap-possibly-change-group group server)
1495 (imap-message-flags-add 1496 (imap-message-flags-add
1496 (imap-range-to-message-set (list article)) 1497 (imap-range-to-message-set (list article))
1497 "\\Deleted" 'silent nnimap-server-buffer)) 1498 "\\Deleted" 'silent nnimap-server-buffer))
diff --git a/lisp/gnus/qp.el b/lisp/gnus/qp.el
index afd6ad72b4d..15914922d1c 100644
--- a/lisp/gnus/qp.el
+++ b/lisp/gnus/qp.el
@@ -118,7 +118,7 @@ encode lines starting with \"From\"."
118 (not (eobp))) 118 (not (eobp)))
119 (insert 119 (insert
120 (prog1 120 (prog1
121 ;; To unibyte in case of Emacs 23 eight-bit. 121 ;; To unibyte in case of Emacs 23 (unicode) eight-bit.
122 (format "=%02X" (mm-multibyte-char-to-unibyte (char-after))) 122 (format "=%02X" (mm-multibyte-char-to-unibyte (char-after)))
123 (delete-char 1)))) 123 (delete-char 1))))
124 ;; Encode white space at the end of lines. 124 ;; Encode white space at the end of lines.
diff --git a/lisp/gnus/utf7.el b/lisp/gnus/utf7.el
index 7347259a35c..a1b7fdc6702 100644
--- a/lisp/gnus/utf7.el
+++ b/lisp/gnus/utf7.el
@@ -80,7 +80,7 @@
80(defconst utf7-utf-16-coding-system 80(defconst utf7-utf-16-coding-system
81 (cond ((mm-coding-system-p 'utf-16-be-no-signature) ; Mule-UCS 81 (cond ((mm-coding-system-p 'utf-16-be-no-signature) ; Mule-UCS
82 'utf-16-be-no-signature) 82 'utf-16-be-no-signature)
83 ((and (mm-coding-system-p 'utf-16-be) ; Emacs 23.1 83 ((and (mm-coding-system-p 'utf-16-be) ; Emacs 21.3, Emacs 22
84 ;; Avoid versions with BOM. 84 ;; Avoid versions with BOM.
85 (= 2 (length (encode-coding-string "a" 'utf-16-be)))) 85 (= 2 (length (encode-coding-string "a" 'utf-16-be))))
86 'utf-16-be) 86 'utf-16-be)
diff --git a/lisp/help.el b/lisp/help.el
index f74293b8dd6..bed25366aab 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -835,8 +835,9 @@ follows the description of the major mode.)\n\n"))
835 ;; Document the major mode. 835 ;; Document the major mode.
836 (let ((mode mode-name)) 836 (let ((mode mode-name))
837 (with-current-buffer standard-output 837 (with-current-buffer standard-output
838 (insert mode) 838 (let ((start (point)))
839 (add-text-properties (- (point) (length mode)) (point) '(face bold)))) 839 (insert (format-mode-line mode))
840 (add-text-properties start (point) '(face bold)))))
840 (princ " mode:\n") 841 (princ " mode:\n")
841 (princ (documentation major-mode))) 842 (princ (documentation major-mode)))
842 (print-help-return-message)))) 843 (print-help-return-message))))
@@ -932,7 +933,7 @@ is currently activated with completion."
932;;; Automatic resizing of temporary buffers. 933;;; Automatic resizing of temporary buffers.
933 934
934(defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2)) 935(defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
935 "*Maximum height of a window displaying a temporary buffer. 936 "Maximum height of a window displaying a temporary buffer.
936This is the maximum height (in text lines) which `resize-temp-buffer-window' 937This is the maximum height (in text lines) which `resize-temp-buffer-window'
937will give to a window displaying a temporary buffer. 938will give to a window displaying a temporary buffer.
938It can also be a function which will be called with the object corresponding 939It can also be a function which will be called with the object corresponding
@@ -971,8 +972,7 @@ out of view."
971 (funcall temp-buffer-max-height (current-buffer)) 972 (funcall temp-buffer-max-height (current-buffer))
972 temp-buffer-max-height)))) 973 temp-buffer-max-height))))
973 974
974;; Provide this for the sake of define-minor-mode which generates 975
975;; defcustoms which require 'help'.
976(provide 'help) 976(provide 'help)
977 977
978;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423 978;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423
diff --git a/lisp/info.el b/lisp/info.el
index e9d7f5ca2de..43ee5cabcbc 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1642,7 +1642,9 @@ If DIRECTION is `backward', search in the reverse direction."
1642 (and (search-backward "\^_" nil t) 1642 (and (search-backward "\^_" nil t)
1643 (looking-at 1643 (looking-at
1644 "\^_\n\\(Tag Table\\|Local Variables\\)")))))) 1644 "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
1645 (let ((search-spaces-regexp Info-search-whitespace-regexp)) 1645 (let ((search-spaces-regexp
1646 (if (or (not isearch-mode) isearch-regexp)
1647 Info-search-whitespace-regexp)))
1646 (if (if backward 1648 (if (if backward
1647 (re-search-backward regexp bound t) 1649 (re-search-backward regexp bound t)
1648 (re-search-forward regexp bound t)) 1650 (re-search-forward regexp bound t))
@@ -1660,7 +1662,9 @@ If DIRECTION is `backward', search in the reverse direction."
1660 ;; If no subfiles, give error now. 1662 ;; If no subfiles, give error now.
1661 (if give-up 1663 (if give-up
1662 (if (null Info-current-subfile) 1664 (if (null Info-current-subfile)
1663 (let ((search-spaces-regexp Info-search-whitespace-regexp)) 1665 (let ((search-spaces-regexp
1666 (if (or (not isearch-mode) isearch-regexp)
1667 Info-search-whitespace-regexp)))
1664 (if backward 1668 (if backward
1665 (re-search-backward regexp) 1669 (re-search-backward regexp)
1666 (re-search-forward regexp))) 1670 (re-search-forward regexp)))
@@ -1731,7 +1735,9 @@ If DIRECTION is `backward', search in the reverse direction."
1731 (and (search-backward "\^_" nil t) 1735 (and (search-backward "\^_" nil t)
1732 (looking-at 1736 (looking-at
1733 "\^_\n\\(Tag Table\\|Local Variables\\)")))))) 1737 "\^_\n\\(Tag Table\\|Local Variables\\)"))))))
1734 (let ((search-spaces-regexp Info-search-whitespace-regexp)) 1738 (let ((search-spaces-regexp
1739 (if (or (not isearch-mode) isearch-regexp)
1740 Info-search-whitespace-regexp)))
1735 (if (if backward 1741 (if (if backward
1736 (re-search-backward regexp nil t) 1742 (re-search-backward regexp nil t)
1737 (re-search-forward regexp nil t)) 1743 (re-search-forward regexp nil t))
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index df603dc0d74..db79d43d321 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -123,6 +123,7 @@ and #define directives otherwise.")
123(defvar gdb-macro-info nil 123(defvar gdb-macro-info nil
124 "Non-nil if GDB knows that the inferior includes preprocessor macro info.") 124 "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
125(defvar gdb-buffer-fringe-width nil) 125(defvar gdb-buffer-fringe-width nil)
126(defvar gdb-signalled nil)
126 127
127(defvar gdb-buffer-type nil 128(defvar gdb-buffer-type nil
128 "One of the symbols bound in `gdb-buffer-rules'.") 129 "One of the symbols bound in `gdb-buffer-rules'.")
@@ -258,11 +259,19 @@ detailed description of this mode.
258 (gdb command-line) 259 (gdb command-line)
259 (gdb-init-1)) 260 (gdb-init-1))
260 261
261(defvar gdb-debug-log nil) 262(defcustom gdb-debug-ring-max 128
263 "Maximum size of `gdb-debug-ring'."
264 :group 'gud
265 :type 'integer
266 :version "22.1")
267
268(defvar gdb-debug-ring nil
269 "List of commands, most recent first, sent to and replies received from GDB.
270This variable is used to debug GDB-UI.")
262 271
263;;;###autoload 272;;;###autoload
264(defcustom gdb-enable-debug-log nil 273(defcustom gdb-enable-debug nil
265 "Non-nil means record the process input and output in `gdb-debug-log'." 274 "Non-nil means record the process input and output in `gdb-debug-ring'."
266 :type 'boolean 275 :type 'boolean
267 :group 'gud 276 :group 'gud
268 :version "22.1") 277 :version "22.1")
@@ -390,7 +399,6 @@ With arg, use separate IO iff arg is positive."
390 expr)) 399 expr))
391 400
392(defun gdb-init-1 () 401(defun gdb-init-1 ()
393 (setq gdb-debug-log nil)
394 (set (make-local-variable 'gud-minor-mode) 'gdba) 402 (set (make-local-variable 'gud-minor-mode) 'gdba)
395 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) 403 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
396 ;; 404 ;;
@@ -436,11 +444,21 @@ With arg, use separate IO iff arg is positive."
436 'gdb-mouse-set-clear-breakpoint) 444 'gdb-mouse-set-clear-breakpoint)
437 (define-key gud-minor-mode-map [left-fringe mouse-2] 445 (define-key gud-minor-mode-map [left-fringe mouse-2]
438 'gdb-mouse-until) 446 'gdb-mouse-until)
447 (define-key gud-minor-mode-map [left-margin drag-mouse-1]
448 'gdb-mouse-until)
439 (define-key gud-minor-mode-map [left-fringe drag-mouse-1] 449 (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
440 'gdb-mouse-until) 450 'gdb-mouse-until)
441 (define-key gud-minor-mode-map [left-margin mouse-2] 451 (define-key gud-minor-mode-map [left-margin mouse-2]
442 'gdb-mouse-until) 452 'gdb-mouse-until)
443 (define-key gud-minor-mode-map [left-margin mouse-3] 453 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
454 'gdb-mouse-jump)
455 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
456 'gdb-mouse-jump)
457 (define-key gud-minor-mode-map [left-fringe C-mouse-2]
458 'gdb-mouse-jump)
459 (define-key gud-minor-mode-map [left-margin C-mouse-2]
460 'gdb-mouse-jump)
461 (define-key gud-minor-mode-map [left-margin mouse-3]
444 'gdb-mouse-toggle-breakpoint-margin) 462 'gdb-mouse-toggle-breakpoint-margin)
445 (define-key gud-minor-mode-map [left-fringe mouse-3] 463 (define-key gud-minor-mode-map [left-fringe mouse-3]
446 'gdb-mouse-toggle-breakpoint-fringe) 464 'gdb-mouse-toggle-breakpoint-fringe)
@@ -469,14 +487,15 @@ With arg, use separate IO iff arg is positive."
469 gdb-source-file-list nil 487 gdb-source-file-list nil
470 gdb-error nil 488 gdb-error nil
471 gdb-macro-info nil 489 gdb-macro-info nil
472 gdb-buffer-fringe-width (car (window-fringes))) 490 gdb-buffer-fringe-width (car (window-fringes))
491 gdb-debug-ring nil
492 gdb-signalled nil)
473 493
474 (setq gdb-buffer-type 'gdba) 494 (setq gdb-buffer-type 'gdba)
475 495
476 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io)) 496 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
477 497
478 ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4) 498 ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4)
479 (setq gdb-version nil)
480 (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n" 499 (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
481 'gdb-get-version))) 500 'gdb-get-version)))
482 501
@@ -516,7 +535,9 @@ With arg, use separate IO iff arg is positive."
516 (gdb-init-2)) 535 (gdb-init-2))
517 536
518(defun gdb-mouse-until (event) 537(defun gdb-mouse-until (event)
519 "Execute source lines by dragging the overlay arrow (fringe) with the mouse." 538 "Continue running until a source line past the current line.
539The destination source line can be selected either by clicking with mouse-2
540on the fringe/margin or dragging the arrow with mouse-1 (default bindings)."
520 (interactive "e") 541 (interactive "e")
521 (if gud-overlay-arrow-position 542 (if gud-overlay-arrow-position
522 (let ((start (event-start event)) 543 (let ((start (event-start event))
@@ -542,6 +563,40 @@ With arg, use separate IO iff arg is positive."
542 (forward-char 2) 563 (forward-char 2)
543 (gud-call (concat "until *%a"))))))))) 564 (gud-call (concat "until *%a")))))))))
544 565
566(defun gdb-mouse-jump (event)
567 "Set execution address/line.
568The destination source line can be selected either by clicking with mouse-2
569on the fringe/margin or dragging the arrow with mouse-1 (default bindings).
570Unlike gdb-mouse-until the destination address can be before the current
571line, and no execution takes place."
572 (interactive "e")
573 (if gud-overlay-arrow-position
574 (let ((start (event-start event))
575 (end (event-end event))
576 (buffer (marker-buffer gud-overlay-arrow-position)) (line))
577 (if (not (string-match "Machine" mode-name))
578 (if (equal buffer (window-buffer (posn-window end)))
579 (with-current-buffer buffer
580 (when (or (equal start end)
581 (equal (posn-point start)
582 (marker-position
583 gud-overlay-arrow-position)))
584 (setq line (line-number-at-pos (posn-point end)))
585 (progn (gud-call (concat "tbreak " (number-to-string line)))
586 (gud-call (concat "jump " (number-to-string line)))))))
587 (if (equal (marker-buffer gdb-overlay-arrow-position)
588 (window-buffer (posn-window end)))
589 (when (or (equal start end)
590 (equal (posn-point start)
591 (marker-position
592 gdb-overlay-arrow-position)))
593 (save-excursion
594 (goto-line (line-number-at-pos (posn-point end)))
595 (forward-char 2)
596 (progn
597 (gud-call (concat "tbreak *%a"))
598 (gud-call (concat "jump *%a"))))))))))
599
545(defcustom gdb-speedbar-auto-raise nil 600(defcustom gdb-speedbar-auto-raise nil
546 "If non-nil raise speedbar every time display of watch expressions is\ 601 "If non-nil raise speedbar every time display of watch expressions is\
547 updated." 602 updated."
@@ -573,9 +628,6 @@ With arg, automatically raise speedbar iff arg is positive."
573 (require 'tooltip) 628 (require 'tooltip)
574 (save-selected-window 629 (save-selected-window
575 (let ((expr (tooltip-identifier-from-point (point)))) 630 (let ((expr (tooltip-identifier-from-point (point))))
576 (if (and (string-equal gdb-current-language "c")
577 gdb-use-colon-colon-notation gdb-selected-frame)
578 (setq expr (concat gdb-selected-frame "::" expr)))
579 (catch 'already-watched 631 (catch 'already-watched
580 (dolist (var gdb-var-list) 632 (dolist (var gdb-var-list)
581 (if (string-equal expr (car var)) (throw 'already-watched nil))) 633 (if (string-equal expr (car var)) (throw 'already-watched nil)))
@@ -593,11 +645,15 @@ With arg, automatically raise speedbar iff arg is positive."
593(defun gdb-var-create-handler (expr) 645(defun gdb-var-create-handler (expr)
594 (goto-char (point-min)) 646 (goto-char (point-min))
595 (if (re-search-forward gdb-var-create-regexp nil t) 647 (if (re-search-forward gdb-var-create-regexp nil t)
596 (let ((var (list expr 648 (let ((var (list
597 (match-string 1) 649 (if (and (string-equal gdb-current-language "c")
598 (match-string 2) 650 gdb-use-colon-colon-notation gdb-selected-frame)
599 (match-string 3) 651 (setq expr (concat gdb-selected-frame "::" expr))
600 nil nil))) 652 expr)
653 (match-string 1)
654 (match-string 2)
655 (match-string 3)
656 nil nil)))
601 (push var gdb-var-list) 657 (push var gdb-var-list)
602 (speedbar 1) 658 (speedbar 1)
603 (unless (string-equal 659 (unless (string-equal
@@ -613,7 +669,7 @@ With arg, automatically raise speedbar iff arg is positive."
613 ,(nth 1 var) nil))))) 669 ,(nth 1 var) nil)))))
614 (if (search-forward "Undefined command" nil t) 670 (if (search-forward "Undefined command" nil t)
615 (message-box "Watching expressions requires gdb 6.0 onwards") 671 (message-box "Watching expressions requires gdb 6.0 onwards")
616 (message "No symbol \"%s\" in current context." expr)))) 672 (message-box "No symbol \"%s\" in current context." expr))))
617 673
618(defun gdb-var-evaluate-expression-handler (varnum changed) 674(defun gdb-var-evaluate-expression-handler (varnum changed)
619 (goto-char (point-min)) 675 (goto-char (point-min))
@@ -864,7 +920,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
864 "*")) 920 "*"))
865 921
866(defun gdb-display-separate-io-buffer () 922(defun gdb-display-separate-io-buffer ()
867 "Display IO of inferior in a separate window." 923 "Display IO of debugged program in a separate window."
868 (interactive) 924 (interactive)
869 (if gdb-use-separate-io-buffer 925 (if gdb-use-separate-io-buffer
870 (gdb-display-buffer 926 (gdb-display-buffer
@@ -963,7 +1019,7 @@ This filter may simply queue input for a later time."
963 (let ((item (concat string "\n"))) 1019 (let ((item (concat string "\n")))
964 (if gud-running 1020 (if gud-running
965 (progn 1021 (progn
966 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log)) 1022 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
967 (process-send-string proc item)) 1023 (process-send-string proc item))
968 (gdb-enqueue-input item)))) 1024 (gdb-enqueue-input item))))
969 1025
@@ -986,7 +1042,7 @@ This filter may simply queue input for a later time."
986 1042
987(defun gdb-send-item (item) 1043(defun gdb-send-item (item)
988 (setq gdb-flush-pending-output nil) 1044 (setq gdb-flush-pending-output nil)
989 (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log)) 1045 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-ring))
990 (setq gdb-current-item item) 1046 (setq gdb-current-item item)
991 (let ((process (get-buffer-process gud-comint-buffer))) 1047 (let ((process (get-buffer-process gud-comint-buffer)))
992 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 1048 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@@ -1039,7 +1095,7 @@ This filter may simply queue input for a later time."
1039 ("source" gdb-source) 1095 ("source" gdb-source)
1040 ("starting" gdb-starting) 1096 ("starting" gdb-starting)
1041 ("exited" gdb-exited) 1097 ("exited" gdb-exited)
1042 ("signalled" gdb-exited) 1098 ("signalled" gdb-signalled)
1043 ("signal" gdb-stopping) 1099 ("signal" gdb-stopping)
1044 ("breakpoint" gdb-stopping) 1100 ("breakpoint" gdb-stopping)
1045 ("watchpoint" gdb-stopping) 1101 ("watchpoint" gdb-stopping)
@@ -1156,6 +1212,9 @@ directives."
1156 (setq gdb-overlay-arrow-position nil) 1212 (setq gdb-overlay-arrow-position nil)
1157 (gdb-stopping ignored)) 1213 (gdb-stopping ignored))
1158 1214
1215(defun gdb-signalled (ignored)
1216 (setq gdb-signalled t))
1217
1159(defun gdb-frame-begin (ignored) 1218(defun gdb-frame-begin (ignored)
1160 (let ((sink gdb-output-sink)) 1219 (let ((sink gdb-output-sink))
1161 (cond 1220 (cond
@@ -1172,7 +1231,6 @@ directives."
1172It is just like `gdb-stopping', except that if we already set the output 1231It is just like `gdb-stopping', except that if we already set the output
1173sink to `user' in `gdb-stopping', that is fine." 1232sink to `user' in `gdb-stopping', that is fine."
1174 (setq gud-running nil) 1233 (setq gud-running nil)
1175 (setq gdb-active-process t)
1176 (let ((sink gdb-output-sink)) 1234 (let ((sink gdb-output-sink))
1177 (cond 1235 (cond
1178 ((eq sink 'inferior) 1236 ((eq sink 'inferior)
@@ -1180,7 +1238,8 @@ sink to `user' in `gdb-stopping', that is fine."
1180 ((eq sink 'user) t) 1238 ((eq sink 'user) t)
1181 (t 1239 (t
1182 (gdb-resync) 1240 (gdb-resync)
1183 (error "Unexpected stopped annotation"))))) 1241 (error "Unexpected stopped annotation"))))
1242 (if gdb-signalled (gdb-exited ignored)))
1184 1243
1185(defun gdb-error (ignored) 1244(defun gdb-error (ignored)
1186 (setq gdb-error (not gdb-error))) 1245 (setq gdb-error (not gdb-error)))
@@ -1233,7 +1292,10 @@ happens to be appropriate."
1233 "A gud marker filter for gdb. Handle a burst of output from GDB." 1292 "A gud marker filter for gdb. Handle a burst of output from GDB."
1234 (if gdb-flush-pending-output 1293 (if gdb-flush-pending-output
1235 nil 1294 nil
1236 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) 1295 (when gdb-enable-debug
1296 (push (cons 'recv string) gdb-debug-ring)
1297 (if (> (length gdb-debug-ring) gdb-debug-ring-max)
1298 (setcdr (nthcdr (1- gdb-debug-ring-max) gdb-debug-ring) nil)))
1237 ;; Recall the left over gud-marker-acc from last time. 1299 ;; Recall the left over gud-marker-acc from last time.
1238 (setq gud-marker-acc (concat gud-marker-acc string)) 1300 (setq gud-marker-acc (concat gud-marker-acc string))
1239 ;; Start accumulating output for the GUD buffer. 1301 ;; Start accumulating output for the GUD buffer.
diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el
index a8d2d8b8fe1..dadc9cffc7a 100644
--- a/lisp/progmodes/glasses.el
+++ b/lisp/progmodes/glasses.el
@@ -67,7 +67,7 @@
67 67
68 68
69(defcustom glasses-separator "_" 69(defcustom glasses-separator "_"
70 "*String to be displayed as a visual separator in identifiers. 70 "String to be displayed as a visual separator in identifiers.
71It is used both for adding missing separators and for replacing separators 71It is used both for adding missing separators and for replacing separators
72defined by `glasses-original-separator'. If you don't want to add missing 72defined by `glasses-original-separator'. If you don't want to add missing
73separators, set `glasses-separator' to an empty string. If you don't want to 73separators, set `glasses-separator' to an empty string. If you don't want to
@@ -93,7 +93,7 @@ performed."
93 93
94 94
95(defcustom glasses-face nil 95(defcustom glasses-face nil
96 "*Face to be put on capitals of an identifier looked through glasses. 96 "Face to be put on capitals of an identifier looked through glasses.
97If it is nil, no face is placed at the capitalized letter. 97If it is nil, no face is placed at the capitalized letter.
98 98
99For example, you can set `glasses-separator' to an empty string and 99For example, you can set `glasses-separator' to an empty string and
@@ -106,13 +106,13 @@ but will have their capitals in bold."
106 106
107 107
108(defcustom glasses-separate-parentheses-p t 108(defcustom glasses-separate-parentheses-p t
109 "*If non-nil, ensure space between an identifier and an opening parenthesis." 109 "If non-nil, ensure space between an identifier and an opening parenthesis."
110 :group 'glasses 110 :group 'glasses
111 :type 'boolean) 111 :type 'boolean)
112 112
113 113
114(defcustom glasses-uncapitalize-p nil 114(defcustom glasses-uncapitalize-p nil
115 "*If non-nil, downcase embedded capital letters in identifiers. 115 "If non-nil, downcase embedded capital letters in identifiers.
116Only identifiers starting with lower case letters are affected, letters inside 116Only identifiers starting with lower case letters are affected, letters inside
117other identifiers are unchanged." 117other identifiers are unchanged."
118 :group 'glasses 118 :group 'glasses
@@ -122,7 +122,7 @@ other identifiers are unchanged."
122 122
123 123
124(defcustom glasses-uncapitalize-regexp "[a-z]" 124(defcustom glasses-uncapitalize-regexp "[a-z]"
125 "*Regexp matching beginnings of words to be uncapitalized. 125 "Regexp matching beginnings of words to be uncapitalized.
126Only words starting with this regexp are uncapitalized. 126Only words starting with this regexp are uncapitalized.
127The regexp is case sensitive. 127The regexp is case sensitive.
128It has any effect only when `glasses-uncapitalize-p' is non-nil." 128It has any effect only when `glasses-uncapitalize-p' is non-nil."
@@ -133,7 +133,7 @@ It has any effect only when `glasses-uncapitalize-p' is non-nil."
133 133
134 134
135(defcustom glasses-convert-on-write-p nil 135(defcustom glasses-convert-on-write-p nil
136 "*If non-nil, remove separators when writing glasses buffer to a file. 136 "If non-nil, remove separators when writing glasses buffer to a file.
137If you are confused by glasses so much, that you write the separators into code 137If you are confused by glasses so much, that you write the separators into code
138during coding, set this variable to t. The separators will be removed on each 138during coding, set this variable to t. The separators will be removed on each
139file write then. 139file write then.
@@ -313,5 +313,5 @@ at places they belong to."
313(provide 'glasses) 313(provide 'glasses)
314 314
315 315
316;;; arch-tag: a3515167-c89e-484f-90a1-d85143e52b12 316;; arch-tag: a3515167-c89e-484f-90a1-d85143e52b12
317;;; glasses.el ends here 317;;; glasses.el ends here
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index ea2586a31d6..5a09d5dd196 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -456,7 +456,8 @@ required by the caller."
456 (while var-list 456 (while var-list
457 (let* (char (depth 0) (start 0) (var (car var-list)) 457 (let* (char (depth 0) (start 0) (var (car var-list))
458 (expr (car var)) (varnum (nth 1 var)) 458 (expr (car var)) (varnum (nth 1 var))
459 (type (nth 3 var)) (status (nth 5 var))) 459 (type (nth 3 var)) (value (nth 4 var))
460 (status (nth 5 var)))
460 (put-text-property 461 (put-text-property
461 0 (length expr) 'face font-lock-variable-name-face expr) 462 0 (length expr) 'face font-lock-variable-name-face expr)
462 (put-text-property 463 (put-text-property
@@ -470,7 +471,7 @@ required by the caller."
470 (string-match "char \\*$" type))) 471 (string-match "char \\*$" type)))
471 (speedbar-make-tag-line 472 (speedbar-make-tag-line
472 'bracket ?? nil nil 473 'bracket ?? nil nil
473 (concat expr "\t" (nth 4 var)) 474 (concat expr "\t" value)
474 (if (or parent (eq status 'out-of-scope)) 475 (if (or parent (eq status 'out-of-scope))
475 nil 'gdb-edit-value) 476 nil 'gdb-edit-value)
476 nil 477 nil
@@ -491,14 +492,12 @@ required by the caller."
491 (speedbar-make-tag-line 492 (speedbar-make-tag-line
492 'bracket char 493 'bracket char
493 'gdb-speedbar-expand-node varnum 494 'gdb-speedbar-expand-node varnum
494 (concat expr "\t" 495 (concat expr "\t" type "\t" value)
495 type "\t" 496 (if (or parent status)
496 (nth 4 var))
497 (if (or parent status 'out-of-scope)
498 nil 'gdb-edit-value) 497 nil 'gdb-edit-value)
499 nil 498 nil
500 (if (and (or parent status) gdb-show-changed-values) 499 (if (and (or parent (eq status 'out-of-scope))
501 'shadow t) 500 gdb-show-changed-values) 'shadow t)
502 depth) 501 depth)
503 (speedbar-make-tag-line 502 (speedbar-make-tag-line
504 'bracket char 503 'bracket char
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 3c70314703b..cecfe7f5164 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 4.04 8;; Version: 4.06
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,21 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.06
85;; - HTML exporter treats targeted internal links.
86;; - Bug fixes.
87;;
88;; Version 4.05
89;; - Changes to internal link system (thanks to David Wainberg for ideas).
90;; - in-file links: [[Search String]] instead of <file:::Search String>
91;; - automatic links to "radio targets".
92;; - CamelCase not longer active by default, configure org-activate-camels
93;; if you want to turn it back on.
94;; - After following a link, `C-c &' jumps back to it.
95;; - MH-E link support (thanks to Thomas Baumann).
96;; - Special table lines are no longer exported.
97;; - Bug fixes and minor improvements.
98;;
84;; Version 4.04 99;; Version 4.04
85;; - Cleanup tags display in agenda. 100;; - Cleanup tags display in agenda.
86;; - Bug fixes. 101;; - Bug fixes.
@@ -115,7 +130,7 @@
115 130
116;;; Customization variables 131;;; Customization variables
117 132
118(defvar org-version "4.04" 133(defvar org-version "4.06"
119 "The version number of the file org.el.") 134 "The version number of the file org.el.")
120(defun org-version () 135(defun org-version ()
121 (interactive) 136 (interactive)
@@ -125,7 +140,7 @@
125;; versions (Emacs versus XEmacs) and with different versions of outline.el. 140;; versions (Emacs versus XEmacs) and with different versions of outline.el.
126;; The compatibility code in org.el is based on these two constants. 141;; The compatibility code in org.el is based on these two constants.
127(defconst org-xemacs-p (featurep 'xemacs) 142(defconst org-xemacs-p (featurep 'xemacs)
128 "Are we running xemacs?") 143 "Are we running XEmacs?")
129(defconst org-noutline-p (featurep 'noutline) 144(defconst org-noutline-p (featurep 'noutline)
130 "Are we using the new outline mode?") 145 "Are we using the new outline mode?")
131 146
@@ -775,7 +790,7 @@ as possible."
775(defcustom org-level-color-stars-only nil 790(defcustom org-level-color-stars-only nil
776 "Non-nil means fontify only the stars in each headline. 791 "Non-nil means fontify only the stars in each headline.
777When nil, the entire headline is fontified. 792When nil, the entire headline is fontified.
778Changing it requires a restart of Emacs to become effective." 793Changing it requires restart of Emacs to become effective."
779 :group 'org-structure 794 :group 'org-structure
780 :type 'boolean) 795 :type 'boolean)
781 796
@@ -930,6 +945,12 @@ Needs to be set before org.el is loaded."
930 :group 'org-link 945 :group 'org-link
931 :type 'boolean) 946 :type 'boolean)
932 947
948(defcustom org-mark-ring-length 4
949 "Number of different positions to be recorded in the ring
950Changing this requires a restart of Emacs to work correctly."
951 :group 'org-link
952 :type 'interger)
953
933(defcustom org-link-format "<%s>" 954(defcustom org-link-format "<%s>"
934 "Default format for linkes in the buffer. 955 "Default format for linkes in the buffer.
935This is a format string for printf, %s will be replaced by the link text. 956This is a format string for printf, %s will be replaced by the link text.
@@ -948,13 +969,27 @@ recommend an additional URL: prefix, so the format would be \"<URL:%s>\"."
948When nil, it becomes possible to put several links into a line. 969When nil, it becomes possible to put several links into a line.
949Note that in tables, a link never extends accross fields, so in a table 970Note that in tables, a link never extends accross fields, so in a table
950it is always possible to put several links into a line. 971it is always possible to put several links into a line.
951Changing this variable requires a restart of Emacs to become effective." 972Changing this variable requires a restart of Emacs of become effective."
973 :group 'org-link
974 :type 'boolean)
975
976(defcustom org-radio-targets t
977 "Non-nil means activate text matching a link target.
978Radio targets are strings in triple angular brackets, like <<<My Target>>>.
979When this option is set, any occurrence of \"my target\" in normal text
980becomes a link."
981 :group 'org-link
982 :type 'boolean)
983
984(defcustom org-activate-camels nil
985 "Non-nil means, treat words in CamelCase as in-file links.
986Changing this requires restart of Emacs to become effective."
952 :group 'org-link 987 :group 'org-link
953 :type 'boolean) 988 :type 'boolean)
954 989
955(defcustom org-context-in-file-links t 990(defcustom org-context-in-file-links t
956 "Non-nil means, file links from `org-store-link' contain context. 991 "Non-nil means, file links from `org-store-link' contain context.
957The line number will be added to the file name with :: as separator and 992A search string will be added to the file name with :: as separator and
958used to find the context when the link is activated by the command 993used to find the context when the link is activated by the command
959`org-open-at-point'. 994`org-open-at-point'.
960Using a prefix arg to the command \\[org-store-link] (`org-store-link') 995Using a prefix arg to the command \\[org-store-link] (`org-store-link')
@@ -962,6 +997,12 @@ negates this setting for the duration of the command."
962 :group 'org-link 997 :group 'org-link
963 :type 'boolean) 998 :type 'boolean)
964 999
1000(defcustom org-file-link-context-use-camel-case nil
1001 "Non-nil means, use CamelCase to store a search context in a file link.
1002When nil, the search string simply consists of the words of the string."
1003 :group 'org-link
1004 :type 'boolean)
1005
965(defcustom org-keep-stored-link-after-insertion nil 1006(defcustom org-keep-stored-link-after-insertion nil
966 "Non-nil means, keep link in list for entire session. 1007 "Non-nil means, keep link in list for entire session.
967 1008
@@ -1082,13 +1123,15 @@ For more examples, see the system specific constants
1082`org-file-apps-defaults-gnu'." 1123`org-file-apps-defaults-gnu'."
1083 :group 'org-link 1124 :group 'org-link
1084 :type '(repeat 1125 :type '(repeat
1085 (cons (string :tag "Extension") 1126 (cons (choice :value ""
1127 (string :tag "Extension")
1128 (const :tag "Default for unrecognized files" t)
1129 (const :tag "Links to a directory" directory))
1086 (choice :value "" 1130 (choice :value ""
1087 (const :tag "Visit with Emacs" 'emacs) 1131 (const :tag "Visit with Emacs" emacs)
1088 (const :tag "Use system default" 'default) 1132 (const :tag "Use system default" default)
1089 (string :tag "Command") 1133 (string :tag "Command")
1090 (sexp :tag "Lisp form"))))) 1134 (sexp :tag "Lisp form")))))
1091
1092 1135
1093(defgroup org-remember nil 1136(defgroup org-remember nil
1094 "Options concerning interaction with remember.el." 1137 "Options concerning interaction with remember.el."
@@ -1508,6 +1551,15 @@ This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
1508 :group 'org-export 1551 :group 'org-export
1509 :type 'boolean) 1552 :type 'boolean)
1510 1553
1554(defcustom org-export-table-remove-special-lines t
1555 "Remove special lines and marking characters in calculating tables.
1556This removes the special marking character column from tables that are set
1557up for spreadsheet calculations. It also removes the entire lines
1558marked with `!', `_', or `^'. The lines with `$' are kept, because
1559the values of constants may be useful to have."
1560 :group 'org-export
1561 :type 'boolean)
1562
1511(defcustom org-export-prefer-native-exporter-for-tables nil 1563(defcustom org-export-prefer-native-exporter-for-tables nil
1512 "Non-nil means, always export tables created with table.el natively. 1564 "Non-nil means, always export tables created with table.el natively.
1513Natively means, use the HTML code generator in table.el. 1565Natively means, use the HTML code generator in table.el.
@@ -1599,7 +1651,7 @@ Otherwise the buffer will just be saved to a file and stay hidden."
1599 :type 'boolean) 1651 :type 'boolean)
1600 1652
1601(defcustom org-export-html-show-new-buffer nil 1653(defcustom org-export-html-show-new-buffer nil
1602 "Non-nil means, popup buffer containing the exported html text. 1654 "Non-nil means, popup buffer containing the exported HTML text.
1603Otherwise, the buffer will just be saved to a file and stay hidden." 1655Otherwise, the buffer will just be saved to a file and stay hidden."
1604 :group 'org-export 1656 :group 'org-export
1605 :type 'boolean) 1657 :type 'boolean)
@@ -1923,6 +1975,10 @@ When this is non-nil, the headline after the keyword is set to the
1923 (defvar gnus-group-name) 1975 (defvar gnus-group-name)
1924 (defvar gnus-article-current) 1976 (defvar gnus-article-current)
1925 (defvar w3m-current-url) 1977 (defvar w3m-current-url)
1978 (defvar mh-progs)
1979 (defvar mh-current-folder)
1980 (defvar mh-show-folder-buffer)
1981 (defvar mh-index-folder)
1926 (defvar org-selected-point) 1982 (defvar org-selected-point)
1927 (defvar calendar-mode-map) 1983 (defvar calendar-mode-map)
1928 (defvar remember-save-after-remembering) 1984 (defvar remember-save-after-remembering)
@@ -1943,8 +1999,8 @@ When this is non-nil, the headline after the keyword is set to the
1943;; an update. 1999;; an update.
1944(defvar org-table-may-need-update t 2000(defvar org-table-may-need-update t
1945 "Indicates that a table might need an update. 2001 "Indicates that a table might need an update.
1946This variable is set by `org-before-change-function'. `org-table-align' 2002This variable is set by `org-before-change-function'.
1947sets it back to nil.") 2003`org-table-align'sets it back to nil.")
1948(defvar org-mode-hook nil) 2004(defvar org-mode-hook nil)
1949(defvar org-inhibit-startup nil) ; Dynamically-scoped param. 2005(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
1950(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. 2006(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
@@ -1981,17 +2037,11 @@ The following commands are available:
1981 'org-unfontify-region) 2037 'org-unfontify-region)
1982 ;; Activate before-change-function 2038 ;; Activate before-change-function
1983 (set (make-local-variable 'org-table-may-need-update) t) 2039 (set (make-local-variable 'org-table-may-need-update) t)
1984 (make-local-hook 'before-change-functions) ;; needed for XEmacs 2040 (org-add-hook 'before-change-functions 'org-before-change-function nil
1985 (add-hook 'before-change-functions 'org-before-change-function nil 2041 'local)
1986 'local)
1987 ;; FIXME: The following does not work because isearch-mode-end-hook
1988 ;; is called *before* the visibility overlays as removed.
1989 ;; There should be another hook then for me to be used.
1990;; (make-local-hook 'isearch-mode-end-hook) ;; needed for XEmacs
1991;; (add-hook 'isearch-mode-end-hook 'org-show-hierarchy-above nil
1992;; 'local)
1993 ;; Paragraphs and auto-filling 2042 ;; Paragraphs and auto-filling
1994 (org-set-autofill-regexps) 2043 (org-set-autofill-regexps)
2044 (org-update-radio-target-regexp)
1995 ;; Settings for Calc embedded mode 2045 ;; Settings for Calc embedded mode
1996 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n") 2046 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n")
1997 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n") 2047 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n")
@@ -2053,9 +2103,9 @@ The following commands are available:
2053(defconst org-link-regexp 2103(defconst org-link-regexp
2054 (if org-allow-space-in-links 2104 (if org-allow-space-in-links
2055 (concat 2105 (concat
2056 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") 2106 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
2057 (concat 2107 (concat
2058 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") 2108 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
2059 ) 2109 )
2060 "Regular expression for matching links.") 2110 "Regular expression for matching links.")
2061(defconst org-link-maybe-angles-regexp 2111(defconst org-link-maybe-angles-regexp
@@ -2065,6 +2115,10 @@ The following commands are available:
2065 (concat "\000" org-link-regexp "\000") 2115 (concat "\000" org-link-regexp "\000")
2066 "Matches a link and optionally surrounding angle brackets.") 2116 "Matches a link and optionally surrounding angle brackets.")
2067 2117
2118(defconst org-bracket-link-regexp
2119 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
2120 "Matches a link in double brackets.")
2121
2068(defconst org-ts-lengths 2122(defconst org-ts-lengths
2069 (cons (length (format-time-string (car org-time-stamp-formats))) 2123 (cons (length (format-time-string (car org-time-stamp-formats)))
2070 (length (format-time-string (cdr org-time-stamp-formats)))) 2124 (length (format-time-string (cdr org-time-stamp-formats))))
@@ -2092,6 +2146,15 @@ The following commands are available:
2092 'keymap org-mouse-map)) 2146 'keymap org-mouse-map))
2093 t))) 2147 t)))
2094 2148
2149(defun org-activate-links2 (limit)
2150 "Run through the buffer and add overlays to links."
2151 (if (re-search-forward org-bracket-link-regexp limit t)
2152 (progn
2153 (add-text-properties (match-beginning 0) (match-end 0)
2154 (list 'mouse-face 'highlight
2155 'keymap org-mouse-map))
2156 t)))
2157
2095(defun org-activate-dates (limit) 2158(defun org-activate-dates (limit)
2096 "Run through the buffer and add overlays to dates." 2159 "Run through the buffer and add overlays to dates."
2097 (if (re-search-forward org-tsr-regexp limit t) 2160 (if (re-search-forward org-tsr-regexp limit t)
@@ -2101,19 +2164,75 @@ The following commands are available:
2101 'keymap org-mouse-map)) 2164 'keymap org-mouse-map))
2102 t))) 2165 t)))
2103 2166
2167(defvar org-target-link-regexp nil
2168 "Regular expression matching radio targets in plain text.")
2169(defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>"
2170 "Regular expression matching a link target.")
2171(defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>"
2172 "Regular expression matching a link target.")
2173
2174(defun org-activate-target-links (limit)
2175 "Run through the buffer and add overlays to target matches."
2176 (when org-radio-targets
2177 (let ((case-fold-search t))
2178 (if (re-search-forward org-target-link-regexp limit t)
2179 (progn
2180 (add-text-properties (match-beginning 0) (match-end 0)
2181 (list 'mouse-face 'highlight
2182 'keymap org-mouse-map
2183 'org-linked-text t))
2184 t)))))
2185
2186(defun org-update-radio-target-regexp ()
2187 "Find all radio targets in this file and update the regular expression."
2188 (interactive)
2189 (when org-radio-targets
2190 (setq org-target-link-regexp
2191 (org-make-target-link-regexp (org-all-targets 'radio)))
2192 (font-lock-mode -1)
2193 (font-lock-mode 1)))
2194
2195(defun org-all-targets (&optional radio)
2196 "Return a list of all targets in this file.
2197With optional argument RADIO, only find radio targets."
2198 (let ((re (if radio org-radio-target-regexp org-target-regexp))
2199 rtn)
2200 (save-excursion
2201 (goto-char (point-min))
2202 (while (re-search-forward re nil t)
2203 (add-to-list 'rtn (downcase (match-string-no-properties 1))))
2204 rtn)))
2205
2206(defun org-make-target-link-regexp (targets)
2207 "Make regular expression matching all strings in TARGETS.
2208The regular expression finds the targets also if there is a line break
2209between words."
2210 (concat
2211 "\\<\\("
2212 (mapconcat
2213 (lambda (x)
2214 (while (string-match " +" x)
2215 (setq x (replace-match "\\s-+" t t x)))
2216 x)
2217 targets
2218 "\\|")
2219 "\\)\\>"))
2220
2104(defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>" 2221(defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>"
2105 "Matches CamelCase words, possibly with a star before it.") 2222 "Matches CamelCase words, possibly with a star before it.")
2223
2106(defun org-activate-camels (limit) 2224(defun org-activate-camels (limit)
2107 "Run through the buffer and add overlays to dates." 2225 "Run through the buffer and add overlays to dates."
2108 (if (re-search-forward org-camel-regexp limit t) 2226 (if org-activate-camels
2109 (progn 2227 (if (re-search-forward org-camel-regexp limit t)
2110 (add-text-properties (match-beginning 0) (match-end 0) 2228 (progn
2111 (list 'mouse-face 'highlight 2229 (add-text-properties (match-beginning 0) (match-end 0)
2112 'keymap org-mouse-map)) 2230 (list 'mouse-face 'highlight
2113 t))) 2231 'keymap org-mouse-map))
2232 t))))
2114 2233
2115(defun org-activate-tags (limit) 2234(defun org-activate-tags (limit)
2116 (if (re-search-forward "[ \t]\\(:[A-Za-z_:]+:\\)[ \r\n]" limit t) 2235 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
2117 (progn 2236 (progn
2118 (add-text-properties (match-beginning 1) (match-end 1) 2237 (add-text-properties (match-beginning 1) (match-end 1)
2119 (list 'mouse-face 'highlight 2238 (list 'mouse-face 'highlight
@@ -2138,6 +2257,8 @@ The following commands are available:
2138 (let ((org-font-lock-extra-keywords 2257 (let ((org-font-lock-extra-keywords
2139 (list 2258 (list
2140 '(org-activate-links (0 'org-link t)) 2259 '(org-activate-links (0 'org-link t))
2260 '(org-activate-links2 (0 'org-link t))
2261 '(org-activate-target-links (0 'org-link t))
2141 '(org-activate-dates (0 'org-link t)) 2262 '(org-activate-dates (0 'org-link t))
2142 '(org-activate-camels (0 'org-link t)) 2263 '(org-activate-camels (0 'org-link t))
2143 '(org-activate-tags (1 'org-link t)) 2264 '(org-activate-tags (1 'org-link t))
@@ -2199,7 +2320,8 @@ The following commands are available:
2199 (inhibit-read-only t) (inhibit-point-motion-hooks t) 2320 (inhibit-read-only t) (inhibit-point-motion-hooks t)
2200 (inhibit-modification-hooks t) 2321 (inhibit-modification-hooks t)
2201 deactivate-mark buffer-file-name buffer-file-truename) 2322 deactivate-mark buffer-file-name buffer-file-truename)
2202 (remove-text-properties beg end '(mouse-face nil keymap nil)))) 2323 (remove-text-properties beg end
2324 '(mouse-face nil keymap nil org-linked-text nil))))
2203 2325
2204;;; Visibility cycling 2326;;; Visibility cycling
2205 2327
@@ -2433,8 +2555,10 @@ to the new location, making it and the headline hierarchy above it visible."
2433 (org-get-location (current-buffer) org-goto-help))) 2555 (org-get-location (current-buffer) org-goto-help)))
2434 (if selected-point 2556 (if selected-point
2435 (progn 2557 (progn
2558 (org-mark-ring-push org-goto-start-pos)
2436 (goto-char selected-point) 2559 (goto-char selected-point)
2437 (if (org-invisible-p) (org-show-hierarchy-above))) 2560 (if (or (org-invisible-p) (org-invisible-p2))
2561 (org-show-hierarchy-above)))
2438 (error "Quit")))) 2562 (error "Quit"))))
2439 2563
2440(defun org-get-location (buf help) 2564(defun org-get-location (buf help)
@@ -2536,7 +2660,7 @@ or nil."
2536 2660
2537(defun org-insert-item () 2661(defun org-insert-item ()
2538 "Insert a new item at the current level. 2662 "Insert a new item at the current level.
2539Return t when tings worked, nil when we are not in an item." 2663Return t when things worked, nil when we are not in an item."
2540 (when (save-excursion 2664 (when (save-excursion
2541 (condition-case nil 2665 (condition-case nil
2542 (progn 2666 (progn
@@ -3213,7 +3337,7 @@ At all other locations, this simply calls `ispell-complete-word'."
3213 (let* ((end (point)) 3337 (let* ((end (point))
3214 (beg1 (save-excursion 3338 (beg1 (save-excursion
3215 (if (equal (char-before (point)) ?\ ) (backward-char 1)) 3339 (if (equal (char-before (point)) ?\ ) (backward-char 1))
3216 (skip-chars-backward "a-zA-Z_") 3340 (skip-chars-backward "a-zA-Z_@0-9")
3217 (point))) 3341 (point)))
3218 (beg (save-excursion 3342 (beg (save-excursion
3219 (if (equal (char-before (point)) ?\ ) (backward-char 1)) 3343 (if (equal (char-before (point)) ?\ ) (backward-char 1))
@@ -3247,7 +3371,11 @@ At all other locations, this simply calls `ispell-complete-word'."
3247 (save-excursion 3371 (save-excursion
3248 (goto-char (point-min)) 3372 (goto-char (point-min))
3249 (while (re-search-forward org-todo-line-regexp nil t) 3373 (while (re-search-forward org-todo-line-regexp nil t)
3250 (push (list (org-make-org-heading-camel (match-string 3))) 3374 (push (list
3375 (if org-file-link-context-use-camel-case
3376 (org-make-org-heading-camel (match-string 3) t)
3377 (org-make-org-heading-search-string
3378 (match-string 3) t)))
3251 tbl))) 3379 tbl)))
3252 tbl) 3380 tbl)
3253 (tag (setq type :tag beg beg1) 3381 (tag (setq type :tag beg beg1)
@@ -3475,9 +3603,8 @@ that the match should indeed be shown."
3475 (setq cnt (1+ cnt)) 3603 (setq cnt (1+ cnt))
3476 (org-highlight-new-match (match-beginning 0) (match-end 0)) 3604 (org-highlight-new-match (match-beginning 0) (match-end 0))
3477 (org-show-hierarchy-above)))) 3605 (org-show-hierarchy-above))))
3478 (make-local-hook 'before-change-functions) ; needed for XEmacs 3606 (org-add-hook 'before-change-functions 'org-remove-occur-highlights
3479 (add-hook 'before-change-functions 'org-remove-occur-highlights 3607 nil 'local)
3480 nil 'local)
3481 (run-hooks 'org-occur-hook) 3608 (run-hooks 'org-occur-hook)
3482 (if (interactive-p) 3609 (if (interactive-p)
3483 (message "%d match(es) for regexp %s" cnt regexp)) 3610 (message "%d match(es) for regexp %s" cnt regexp))
@@ -3488,7 +3615,8 @@ that the match should indeed be shown."
3488 (catch 'exit 3615 (catch 'exit
3489 (if (org-on-heading-p t) 3616 (if (org-on-heading-p t)
3490 (org-flag-heading nil) ; only show the heading 3617 (org-flag-heading nil) ; only show the heading
3491 (and (org-invisible-p) (org-show-hidden-entry))) ; show entire entry 3618 (and (or (org-invisible-p) (org-invisible-p2))
3619 (org-show-hidden-entry))) ; show entire entry
3492 (save-excursion 3620 (save-excursion
3493 (and org-show-following-heading 3621 (and org-show-following-heading
3494 (outline-next-heading) 3622 (outline-next-heading)
@@ -3765,7 +3893,8 @@ used to insert the time stamp into the buffer to include the time."
3765 (progn 3893 (progn
3766 (use-local-map map) 3894 (use-local-map map)
3767 (setq ans (read-string prompt "" nil nil)) 3895 (setq ans (read-string prompt "" nil nil))
3768 (setq ans (or ans1 ans2 ans))) 3896 (if (not (string-match "\\S-" ans)) (setq ans nil))
3897 (setq ans (or ans1 ans ans2)))
3769 (use-local-map old-map))))) 3898 (use-local-map old-map)))))
3770 ;; Naked prompt only 3899 ;; Naked prompt only
3771 (setq ans (read-string prompt "" nil timestr))) 3900 (setq ans (read-string prompt "" nil timestr)))
@@ -4133,10 +4262,8 @@ The following commands are available:
4133 (use-local-map org-agenda-mode-map) 4262 (use-local-map org-agenda-mode-map)
4134 (easy-menu-add org-agenda-menu) 4263 (easy-menu-add org-agenda-menu)
4135 (if org-startup-truncated (setq truncate-lines t)) 4264 (if org-startup-truncated (setq truncate-lines t))
4136 (make-local-hook 'post-command-hook) ; Needed for XEmacs 4265 (org-add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
4137 (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) 4266 (org-add-hook 'pre-command-hook 'org-unhighlight nil 'local)
4138 (make-local-hook 'pre-command-hook) ; Needed for XEmacs
4139 (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
4140 (unless org-agenda-keep-modes 4267 (unless org-agenda-keep-modes
4141 (setq org-agenda-follow-mode nil 4268 (setq org-agenda-follow-mode nil
4142 org-agenda-show-log nil)) 4269 org-agenda-show-log nil))
@@ -5285,27 +5412,6 @@ the documentation of `org-diary'."
5285 (throw 'exit t))) 5412 (throw 'exit t)))
5286 nil))) 5413 nil)))
5287 5414
5288(defun org-get-tags-at (&optional pos)
5289 "Get a list of all headline targs applicable at POS.
5290POS defaults to point. If tags are inherited, the list contains
5291the targets in the same sequence as the headlines appear, i.e.
5292the tags of the current headline come last."
5293 (interactive)
5294 (let (tags)
5295 (save-excursion
5296 (goto-char (or pos (point)))
5297 (save-match-data
5298 (org-back-to-heading t)
5299 (condition-case nil
5300 (while t
5301 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
5302 (setq tags (append (org-split-string (match-string 1) ":") tags)))
5303 (or org-use-tag-inheritance (error ""))
5304 (org-up-heading-all 1))
5305 (error nil))))
5306 (message "%s" tags)
5307 tags))
5308
5309(defun org-agenda-get-todos () 5415(defun org-agenda-get-todos ()
5310 "Return the TODO information for agenda display." 5416 "Return the TODO information for agenda display."
5311 (let* ((props (list 'face nil 5417 (let* ((props (list 'face nil
@@ -5726,7 +5832,7 @@ only the correctly processes TXT should be returned - this is used by
5726 (when (and (or (eq org-agenda-remove-tags-when-in-prefix t) 5832 (when (and (or (eq org-agenda-remove-tags-when-in-prefix t)
5727 (and org-agenda-remove-tags-when-in-prefix 5833 (and org-agenda-remove-tags-when-in-prefix
5728 org-prefix-has-tag)) 5834 org-prefix-has-tag))
5729 (string-match ":[a-zA-Z_:]+:[ \t]*$" txt)) 5835 (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" txt))
5730 (setq txt (replace-match "" t t txt))) 5836 (setq txt (replace-match "" t t txt)))
5731 5837
5732 ;; Create the final string 5838 ;; Create the final string
@@ -6076,6 +6182,27 @@ the same tree node, and the headline of the tree node in the Org-mode file."
6076 (org-agenda-change-all-lines newhead hdmarker) 6182 (org-agenda-change-all-lines newhead hdmarker)
6077 (beginning-of-line 1))) 6183 (beginning-of-line 1)))
6078 6184
6185(defun org-get-tags-at (&optional pos)
6186 "Get a list of all headline targs applicable at POS.
6187POS defaults to point. If tags are inherited, the list contains
6188the targets in the same sequence as the headlines appear, i.e.
6189the tags of the current headline come last."
6190 (interactive)
6191 (let (tags)
6192 (save-excursion
6193 (goto-char (or pos (point)))
6194 (save-match-data
6195 (org-back-to-heading t)
6196 (condition-case nil
6197 (while t
6198 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
6199 (setq tags (append (org-split-string (match-string 1) ":") tags)))
6200 (or org-use-tag-inheritance (error ""))
6201 (org-up-heading-all 1))
6202 (error nil))))
6203 (message "%s" tags)
6204 tags))
6205
6079(defun org-agenda-set-tags () 6206(defun org-agenda-set-tags ()
6080 "Set tags for the current headline." 6207 "Set tags for the current headline."
6081 (interactive) 6208 (interactive)
@@ -6298,7 +6425,7 @@ are included in the output."
6298 (mapconcat 'regexp-quote 6425 (mapconcat 'regexp-quote
6299 (nreverse (cdr (reverse org-todo-keywords))) 6426 (nreverse (cdr (reverse org-todo-keywords)))
6300 "\\|") 6427 "\\|")
6301 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_:]+:\\)?[ \t]*[\n\r]")) 6428 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*[\n\r]"))
6302 (props (list 'face nil 6429 (props (list 'face nil
6303 'done-face 'org-done 6430 'done-face 'org-done
6304 'undone-face nil 6431 'undone-face nil
@@ -6386,7 +6513,7 @@ MATCH can contain positive and negative selection of tags, like
6386 (let ((match0 match) minus tag mm matcher orterms term orlist) 6513 (let ((match0 match) minus tag mm matcher orterms term orlist)
6387 (setq orterms (org-split-string match "|")) 6514 (setq orterms (org-split-string match "|"))
6388 (while (setq term (pop orterms)) 6515 (while (setq term (pop orterms))
6389 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_]+\\)" term) 6516 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_@0-9]+\\)" term)
6390 (setq minus (and (match-end 1) 6517 (setq minus (and (match-end 1)
6391 (equal (match-string 1 term) "-")) 6518 (equal (match-string 1 term) "-"))
6392 tag (match-string 2 term) 6519 tag (match-string 2 term)
@@ -6481,7 +6608,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6481 (re (concat "^" outline-regexp)) 6608 (re (concat "^" outline-regexp))
6482 (col (current-column)) 6609 (col (current-column))
6483 (current (org-get-tags)) 6610 (current (org-get-tags))
6484 tags hd empty) 6611 tags hd empty invis)
6485 (if arg 6612 (if arg
6486 (save-excursion 6613 (save-excursion
6487 (goto-char (point-min)) 6614 (goto-char (point-min))
@@ -6505,19 +6632,23 @@ With prefix ARG, realign all tags in headings in the current buffer."
6505 (if (equal current "") 6632 (if (equal current "")
6506 (progn 6633 (progn
6507 (end-of-line 1) 6634 (end-of-line 1)
6508 (or empty (insert " "))) 6635 (or empty (insert-before-markers " ")))
6509 (beginning-of-line 1) 6636 (beginning-of-line 1)
6637 (setq invis (org-invisible-p))
6510 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*")) 6638 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
6511 (setq hd (match-string 1)) 6639 (setq hd (match-string 1))
6512 (delete-region (match-beginning 0) (match-end 0)) 6640 (delete-region (match-beginning 0) (match-end 0))
6513 (insert (org-trim hd) (if empty "" " "))) 6641 (insert-before-markers (org-trim hd) (if empty "" " ")))
6642 ;; FIXME: What happens when adding a new tag??? Seems OK!!!
6514 (unless (equal tags "") 6643 (unless (equal tags "")
6515 (move-to-column (max (current-column) 6644 (move-to-column (max (current-column)
6516 (if (> org-tags-column 0) 6645 (if (> org-tags-column 0)
6517 org-tags-column 6646 org-tags-column
6518 (- (- org-tags-column) (length tags)))) 6647 (- (- org-tags-column) (length tags))))
6519 t) 6648 t)
6520 (insert tags)) 6649 (insert-before-markers tags)
6650 (if (and (not invis) (org-invisible-p))
6651 (outline-flag-region (point-at-bol) (point) nil)))
6521 (move-to-column col)))) 6652 (move-to-column col))))
6522 6653
6523(defun org-tags-completion-function (string predicate &optional flag) 6654(defun org-tags-completion-function (string predicate &optional flag)
@@ -6551,7 +6682,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6551 (error "Not on a heading")) 6682 (error "Not on a heading"))
6552 (save-excursion 6683 (save-excursion
6553 (beginning-of-line 1) 6684 (beginning-of-line 1)
6554 (if (looking-at ".*[ \t]\\(:[A-Za-z_:]+:\\)[ \t]*\\(\r\\|$\\)") 6685 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
6555 (match-string 1) 6686 (match-string 1)
6556 ""))) 6687 "")))
6557 6688
@@ -6560,7 +6691,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6560 (let (tags) 6691 (let (tags)
6561 (save-excursion 6692 (save-excursion
6562 (goto-char (point-min)) 6693 (goto-char (point-min))
6563 (while (re-search-forward "[ \t]:\\([A-Za-z_:]+\\):[ \t\r\n]" nil t) 6694 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
6564 (mapc (lambda (x) (add-to-list 'tags x)) 6695 (mapc (lambda (x) (add-to-list 'tags x))
6565 (org-split-string (match-string 1) ":")))) 6696 (org-split-string (match-string 1) ":"))))
6566 (mapcar 'list tags))) 6697 (mapcar 'list tags)))
@@ -6591,9 +6722,34 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6591 (org-agenda-list nil (time-to-days (org-time-string-to-time 6722 (org-agenda-list nil (time-to-days (org-time-string-to-time
6592 (substring (match-string 1) 0 10))) 6723 (substring (match-string 1) 0 10)))
6593 1) 6724 1)
6594 (let (type path line search (pos (point))) 6725 (let (type path link line search (pos (point)))
6595 (catch 'match 6726 (catch 'match
6596 (save-excursion 6727 (save-excursion
6728 (skip-chars-forward "^]\n\r")
6729 (when (and (re-search-backward "\\[\\[" nil t)
6730 (looking-at org-bracket-link-regexp)
6731 (<= (match-beginning 0) pos)
6732 (>= (match-end 0) pos))
6733 (setq link (match-string 1))
6734 (while (string-match " *\n *" link)
6735 (setq link (replace-match " " t t link)))
6736 (if (string-match org-link-regexp link)
6737 (setq type (match-string 1)
6738 path (match-string 2))
6739 (setq type "thisfile"
6740 path link))
6741 (throw 'match t)))
6742
6743 (when (get-text-property (point) 'org-linked-text)
6744 (setq type "thisfile"
6745 pos (if (get-text-property (1+ (point)) 'org-linked-text)
6746 (1+ (point)) (point))
6747 path (buffer-substring
6748 (previous-single-property-change pos 'org-linked-text)
6749 (next-single-property-change pos 'org-linked-text)))
6750 (throw 'match t))
6751
6752 (save-excursion
6597 (skip-chars-backward 6753 (skip-chars-backward
6598 (concat (if org-allow-space-in-links "^" "^ ") 6754 (concat (if org-allow-space-in-links "^" "^ ")
6599 org-non-link-chars)) 6755 org-non-link-chars))
@@ -6606,7 +6762,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6606 (throw 'match t))) 6762 (throw 'match t)))
6607 (save-excursion 6763 (save-excursion
6608 (skip-chars-backward "^ \t\n\r") 6764 (skip-chars-backward "^ \t\n\r")
6609 (when (looking-at "\\(:[A-Za-z_:]+\\):[ \t\r\n]") 6765 (when (looking-at "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
6610 (setq type "tags" 6766 (setq type "tags"
6611 path (match-string 1)) 6767 path (match-string 1))
6612 (while (string-match ":" path) 6768 (while (string-match ":" path)
@@ -6614,7 +6770,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6614 (throw 'match t))) 6770 (throw 'match t)))
6615 (save-excursion 6771 (save-excursion
6616 (skip-chars-backward "a-zA-Z_") 6772 (skip-chars-backward "a-zA-Z_")
6617 (when (looking-at org-camel-regexp) 6773 (when (and org-activate-camels
6774 (looking-at org-camel-regexp))
6618 (setq type "camel" path (match-string 0)) 6775 (setq type "camel" path (match-string 0))
6619 (if (equal (char-before) ?*) 6776 (if (equal (char-before) ?*)
6620 (setq path (concat "*" path)))) 6777 (setq path (concat "*" path))))
@@ -6639,7 +6796,9 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6639 6796
6640 ((string= type "tags") 6797 ((string= type "tags")
6641 (org-tags-view in-emacs path)) 6798 (org-tags-view in-emacs path))
6642 ((string= type "camel") 6799 ((or (string= type "camel")
6800 (string= type "thisfile"))
6801 (org-mark-ring-push)
6643 (org-link-search 6802 (org-link-search
6644 path 6803 path
6645 (cond ((equal in-emacs '(4)) 'occur) 6804 (cond ((equal in-emacs '(4)) 'occur)
@@ -6686,6 +6845,14 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6686 article (match-string 3 path)) 6845 article (match-string 3 path))
6687 (org-follow-wl-link folder article))) 6846 (org-follow-wl-link folder article)))
6688 6847
6848 ((string= type "mhe")
6849 (let (folder article)
6850 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
6851 (error "Error in MHE link"))
6852 (setq folder (match-string 1 path)
6853 article (match-string 3 path))
6854 (org-follow-mhe-link folder article)))
6855
6689 ((string= type "rmail") 6856 ((string= type "rmail")
6690 (let (folder article) 6857 (let (folder article)
6691 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) 6858 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
@@ -6717,11 +6884,19 @@ sparse tree. In ordinary files, `occur' will be used to list matches.
6717If the current buffer is in `dired-mode', grep will be used to search 6884If the current buffer is in `dired-mode', grep will be used to search
6718in all files." 6885in all files."
6719 (let ((case-fold-search t) 6886 (let ((case-fold-search t)
6720 (s0 s) 6887 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
6721 (pos (point)) 6888 (pos (point))
6722 (pre "") (post "") 6889 (pre "") (post "")
6723 words re0 re1 re2 re3 re4 re5 reall) 6890 words re0 re1 re2 re3 re4 re5 reall camel)
6724 (cond ((string-match "^/\\(.*\\)/$" s) 6891 (cond ((save-excursion
6892 (goto-char (point-min))
6893 (and
6894 (re-search-forward
6895 (concat "<<" (regexp-quote s0) ">>") nil t)
6896 (setq pos (match-beginning 0))))
6897 ;; There is an exact target for this
6898 (goto-char pos))
6899 ((string-match "^/\\(.*\\)/$" s)
6725 ;; A regular expression 6900 ;; A regular expression
6726 (cond 6901 (cond
6727 ((eq major-mode 'org-mode) 6902 ((eq major-mode 'org-mode)
@@ -6729,17 +6904,22 @@ in all files."
6729 ;;((eq major-mode 'dired-mode) 6904 ;;((eq major-mode 'dired-mode)
6730 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) 6905 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
6731 (t (org-do-occur (match-string 1 s))))) 6906 (t (org-do-occur (match-string 1 s)))))
6732 ((string-match (concat "^" org-camel-regexp) s) 6907 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s))
6733 ;; A camel 6908 t)
6734 (if (equal (string-to-char s) ?*) 6909 ;; A camel or a normal search string
6735 (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*" 6910 (when (equal (string-to-char s) ?*)
6736 post "[ \t]*$" 6911 ;; Anchor on headlines, post may include tags.
6737 s (substring s 1))) 6912 (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*"
6913 post "[ \t]*\\([ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
6914 s (substring s 1)))
6738 (remove-text-properties 6915 (remove-text-properties
6739 0 (length s) 6916 0 (length s)
6740 '(face nil mouse-face nil keymap nil fontified nil) s) 6917 '(face nil mouse-face nil keymap nil fontified nil) s)
6741 ;; Make a series of regular expressions to find a match 6918 ;; Make a series of regular expressions to find a match
6742 (setq words (org-camel-to-words s) 6919 (setq words
6920 (if camel
6921 (org-camel-to-words s)
6922 (org-split-string s "[ \n\r\t]+"))
6743 re0 (concat "<<" (regexp-quote s0) ">>") 6923 re0 (concat "<<" (regexp-quote s0) ">>")
6744 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>") 6924 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>")
6745 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>") 6925 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>")
@@ -6770,7 +6950,8 @@ in all files."
6770 (goto-char (point-min)) 6950 (goto-char (point-min))
6771 (if (search-forward s nil t) 6951 (if (search-forward s nil t)
6772 (goto-char (match-beginning 0)) 6952 (goto-char (match-beginning 0))
6773 (error "No match")))))) 6953 (error "No match"))))
6954 (and (eq major-mode 'org-mode) (org-show-hierarchy-above))))
6774 6955
6775(defun org-do-occur (regexp &optional cleanup) 6956(defun org-do-occur (regexp &optional cleanup)
6776 "Call the Emacs command `occur'. 6957 "Call the Emacs command `occur'.
@@ -6791,6 +6972,47 @@ to read."
6791 (goto-char (point-min)) 6972 (goto-char (point-min))
6792 (select-window cwin)))) 6973 (select-window cwin))))
6793 6974
6975(defvar org-mark-ring nil
6976 "Mark ring for positions before jumps in Org-mode.")
6977(defvar org-mark-ring-last-goto nil
6978 "Last position in the mark ring used to go back.")
6979;; Fill and close the ring
6980(setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded
6981(loop for i from 1 to org-mark-ring-length do
6982 (push (make-marker) org-mark-ring))
6983(setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring)
6984 org-mark-ring)
6985
6986(defun org-mark-ring-push (&optional pos buffer)
6987 "Put the current position or POS into the mark ring and rotate it."
6988 (interactive)
6989 (setq pos (or pos (point)))
6990 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring))
6991 (move-marker (car org-mark-ring)
6992 (or pos (point))
6993 (or buffer (current-buffer)))
6994 (message
6995 (substitute-command-keys
6996 "Position saved to mark ring, go back with \\[org-mark-ring-goto].")))
6997
6998(defun org-mark-ring-goto (&optional n)
6999 "Jump to the previous position in the mark ring.
7000With prefix arg N, jump back that many stored positions. When
7001called several times in succession, walk through the entire ring.
7002Org-mode commands jumping to a different position in the current file,
7003or to another Org-mode file, automatically push the old position
7004onto the ring."
7005 (interactive "p")
7006 (let (p m)
7007 (if (eq last-command this-command)
7008 (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring)))
7009 (setq p org-mark-ring))
7010 (setq org-mark-ring-last-goto p)
7011 (setq m (car p))
7012 (switch-to-buffer (marker-buffer m))
7013 (goto-char m)
7014 (if (or (org-invisible-p) (org-invisible-p2)) (org-show-hierarchy-above))))
7015
6794(defun org-camel-to-words (s) 7016(defun org-camel-to-words (s)
6795 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")." 7017 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
6796 (let ((case-fold-search nil) 7018 (let ((case-fold-search nil)
@@ -6800,10 +7022,20 @@ to read."
6800 (setq s (substring s (1+ (match-beginning 0))))) 7022 (setq s (substring s (1+ (match-beginning 0)))))
6801 (nreverse (cons s words)))) 7023 (nreverse (cons s words))))
6802 7024
7025(defun org-remove-angle-brackets (s)
7026 (if (equal (substring s 0 1) "<") (setq s (substring s 1)))
7027 (if (equal (substring s -1) ">") (setq s (substring s 0 -1)))
7028 s)
7029(defun org-add-angle-brackets (s)
7030 (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s)))
7031 (if (equal (substring s -1) ">") nil (setq s (concat s ">")))
7032 s)
7033
6803(defun org-follow-bbdb-link (name) 7034(defun org-follow-bbdb-link (name)
6804 "Follow a BBDB link to NAME." 7035 "Follow a BBDB link to NAME."
6805 (require 'bbdb) 7036 (require 'bbdb)
6806 (let ((inhibit-redisplay t)) 7037 (let ((inhibit-redisplay t)
7038 (bbdb-electric-p nil))
6807 (catch 'exit 7039 (catch 'exit
6808 ;; Exact match on name 7040 ;; Exact match on name
6809 (bbdb-name (concat "\\`" name "\\'") nil) 7041 (bbdb-name (concat "\\`" name "\\'") nil)
@@ -6839,6 +7071,7 @@ to read."
6839(defun org-follow-vm-link (&optional folder article readonly) 7071(defun org-follow-vm-link (&optional folder article readonly)
6840 "Follow a VM link to FOLDER and ARTICLE." 7072 "Follow a VM link to FOLDER and ARTICLE."
6841 (require 'vm) 7073 (require 'vm)
7074 (setq article (org-add-angle-brackets article))
6842 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder) 7075 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
6843 ;; ange-ftp or efs or tramp access 7076 ;; ange-ftp or efs or tramp access
6844 (let ((user (or (match-string 1 folder) (user-login-name))) 7077 (let ((user (or (match-string 1 folder) (user-login-name)))
@@ -6872,12 +7105,14 @@ to read."
6872 7105
6873(defun org-follow-wl-link (folder article) 7106(defun org-follow-wl-link (folder article)
6874 "Follow a Wanderlust link to FOLDER and ARTICLE." 7107 "Follow a Wanderlust link to FOLDER and ARTICLE."
7108 (setq article (org-add-angle-brackets article))
6875 (wl-summary-goto-folder-subr folder 'no-sync t nil t) 7109 (wl-summary-goto-folder-subr folder 'no-sync t nil t)
6876 (if article (wl-summary-jump-to-msg-by-message-id article)) 7110 (if article (wl-summary-jump-to-msg-by-message-id article ">"))
6877 (wl-summary-redisplay)) 7111 (wl-summary-redisplay))
6878 7112
6879(defun org-follow-rmail-link (folder article) 7113(defun org-follow-rmail-link (folder article)
6880 "Follow an RMAIL link to FOLDER and ARTICLE." 7114 "Follow an RMAIL link to FOLDER and ARTICLE."
7115 (setq article (org-add-angle-brackets article))
6881 (let (message-number) 7116 (let (message-number)
6882 (save-excursion 7117 (save-excursion
6883 (save-window-excursion 7118 (save-window-excursion
@@ -6898,6 +7133,106 @@ to read."
6898 message-number) 7133 message-number)
6899 (error "Message not found")))) 7134 (error "Message not found"))))
6900 7135
7136;; mh-e integration based on planner-mode
7137(defun org-mhe-get-message-real-folder ()
7138 "Return the name of the current message real folder, so if you use
7139sequences, it will now work."
7140 (save-excursion
7141 (let* ((folder
7142 (if (equal major-mode 'mh-folder-mode)
7143 mh-current-folder
7144 ;; Refer to the show buffer
7145 mh-show-folder-buffer))
7146 (end-index
7147 (if (boundp 'mh-index-folder)
7148 (min (length mh-index-folder) (length folder))))
7149 )
7150 ;; a simple test on mh-index-data does not work, because
7151 ;; mh-index-data is always nil in a show buffer.
7152 (if (and (boundp 'mh-index-folder)
7153 (string= mh-index-folder (substring folder 0 end-index)))
7154 (if (equal major-mode 'mh-show-mode)
7155 (save-window-excursion
7156 (when (buffer-live-p (get-buffer folder))
7157 (progn
7158 (pop-to-buffer folder)
7159 (org-mhe-get-message-folder-from-index)
7160 )
7161 ))
7162 (org-mhe-get-message-folder-from-index)
7163 )
7164 folder
7165 )
7166 )))
7167
7168(defun org-mhe-get-message-folder-from-index ()
7169 "Returns the name of the message folder in a index folder buffer."
7170 (save-excursion
7171 (mh-index-previous-folder)
7172 (if (not (re-search-forward "^\\(+.*\\)$" nil t))
7173 (message "Problem getting folder from index.")
7174 (message (match-string 1)))))
7175
7176(defun org-mhe-get-message-folder ()
7177 "Return the name of the current message folder. Be careful if you
7178use sequences."
7179 (save-excursion
7180 (if (equal major-mode 'mh-folder-mode)
7181 mh-current-folder
7182 ;; Refer to the show buffer
7183 mh-show-folder-buffer)))
7184
7185(defun org-mhe-get-message-num ()
7186 "Return the number of the current message. Be careful if you
7187use sequences."
7188 (save-excursion
7189 (if (equal major-mode 'mh-folder-mode)
7190 (mh-get-msg-num nil)
7191 ;; Refer to the show buffer
7192 (mh-show-buffer-message-number))))
7193
7194(defun org-mhe-get-header (header)
7195 "Return a header of the message in folder mode. This will create a
7196show buffer for the corresponding message. If you have a more clever
7197idea..."
7198 (let* ((folder (org-mhe-get-message-folder))
7199 (num (org-mhe-get-message-num))
7200 (buffer (get-buffer-create (concat "show-" folder)))
7201 (header-field))
7202 (with-current-buffer buffer
7203 (mh-display-msg num folder)
7204 (if (equal major-mode 'mh-folder-mode)
7205 (mh-header-display)
7206 (mh-show-header-display))
7207 (set-buffer buffer)
7208 (setq header-field (mh-get-header-field header))
7209 (if (equal major-mode 'mh-folder-mode)
7210 (mh-show)
7211 (mh-show-show))
7212 header-field)))
7213
7214(defun org-follow-mhe-link (folder article)
7215 "Follow an MHE link to FOLDER and ARTICLE."
7216 (setq article (org-add-angle-brackets article))
7217 (require 'mh-e)
7218 (mh-find-path)
7219 (let* ((show-buf (concat "show-" folder)))
7220 (mh-visit-folder folder)
7221 (get-buffer-create show-buf)
7222 (mh-show-msg
7223 (string-to-number
7224 (car (split-string
7225 (with-temp-buffer
7226 (call-process
7227 (expand-file-name "pick" mh-progs)
7228 nil t nil
7229 folder
7230 "--message-id"
7231 article)
7232 (buffer-string))
7233 "\n"))))
7234 (pop-to-buffer show-buf)))
7235
6901(defun org-open-file (path &optional in-emacs line search) 7236(defun org-open-file (path &optional in-emacs line search)
6902 "Open the file at PATH. 7237 "Open the file at PATH.
6903First, this expands any special file name abbreviations. Then the 7238First, this expands any special file name abbreviations. Then the
@@ -6913,7 +7248,11 @@ If the file does not exist, an error is thrown."
6913 (let* ((file (if (equal path "") 7248 (let* ((file (if (equal path "")
6914 (buffer-file-name) 7249 (buffer-file-name)
6915 (convert-standard-filename (org-expand-file-name path)))) 7250 (convert-standard-filename (org-expand-file-name path))))
7251 (dirp (file-directory-p file))
6916 (dfile (downcase file)) 7252 (dfile (downcase file))
7253 (old-buffer (current-buffer))
7254 (old-pos (point))
7255 (old-mode major-mode)
6917 ext cmd apps) 7256 ext cmd apps)
6918 (if (and (not (file-exists-p file)) 7257 (if (and (not (file-exists-p file))
6919 (not org-open-non-existing-files)) 7258 (not org-open-non-existing-files))
@@ -6925,7 +7264,8 @@ If the file does not exist, an error is thrown."
6925 (setq apps (append org-file-apps (org-default-apps))) 7264 (setq apps (append org-file-apps (org-default-apps)))
6926 (if in-emacs 7265 (if in-emacs
6927 (setq cmd 'emacs) 7266 (setq cmd 'emacs)
6928 (setq cmd (or (cdr (assoc ext apps)) 7267 (setq cmd (or (and dirp (cdr (assoc 'directory apps)))
7268 (cdr (assoc ext apps))
6929 (cdr (assoc t apps))))) 7269 (cdr (assoc t apps)))))
6930 (when (eq cmd 'mailcap) 7270 (when (eq cmd 'mailcap)
6931 (require 'mailcap) 7271 (require 'mailcap)
@@ -6948,7 +7288,11 @@ If the file does not exist, an error is thrown."
6948 (if search (org-link-search search)))) 7288 (if search (org-link-search search))))
6949 ((consp cmd) 7289 ((consp cmd)
6950 (eval cmd)) 7290 (eval cmd))
6951 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))))) 7291 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
7292 (and (eq major-mode 'org-mode) (eq old-mode 'org-mode)
7293 (or (not (equal old-buffer (current-buffer)))
7294 (not (equal old-pos (point))))
7295 (org-mark-ring-push old-pos old-buffer))))
6952 7296
6953(defun org-default-apps () 7297(defun org-default-apps ()
6954 "Return the default applications for this operating system." 7298 "Return the default applications for this operating system."
@@ -6979,7 +7323,7 @@ For some link types, a prefix arg is interpreted:
6979For links to usenet articles, arg negates `org-usenet-links-prefer-google'. 7323For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
6980For file links, arg negates `org-context-in-file-links'." 7324For file links, arg negates `org-context-in-file-links'."
6981 (interactive "P") 7325 (interactive "P")
6982 (let (link cpltxt) 7326 (let (link cpltxt txt (pos (point)))
6983 (cond 7327 (cond
6984 7328
6985 ((eq major-mode 'bbdb-mode) 7329 ((eq major-mode 'bbdb-mode)
@@ -7009,6 +7353,7 @@ For file links, arg negates `org-context-in-file-links'."
7009 (subject (vm-su-subject message)) 7353 (subject (vm-su-subject message))
7010 (author (vm-su-full-name message)) 7354 (author (vm-su-full-name message))
7011 (message-id (vm-su-message-id message))) 7355 (message-id (vm-su-message-id message)))
7356 (setq message-id (org-remove-angle-brackets message-id))
7012 (setq folder (abbreviate-file-name folder)) 7357 (setq folder (abbreviate-file-name folder))
7013 (if (string-match (concat "^" (regexp-quote vm-folder-directory)) 7358 (if (string-match (concat "^" (regexp-quote vm-folder-directory))
7014 folder) 7359 folder)
@@ -7026,12 +7371,25 @@ For file links, arg negates `org-context-in-file-links'."
7026 msgnum (wl-summary-buffer-msgdb))) 7371 msgnum (wl-summary-buffer-msgdb)))
7027 (author (wl-summary-line-from)) ; FIXME: how to get author name? 7372 (author (wl-summary-line-from)) ; FIXME: how to get author name?
7028 (subject "???")) ; FIXME: How to get subject of email? 7373 (subject "???")) ; FIXME: How to get subject of email?
7374 (setq message-id (org-remove-angle-brackets message-id))
7029 (setq cpltxt (concat author " on: " subject)) 7375 (setq cpltxt (concat author " on: " subject))
7030 (setq link (concat cpltxt "\n " 7376 (setq link (concat cpltxt "\n "
7031 (org-make-link 7377 (org-make-link
7032 "wl:" wl-summary-buffer-folder-name 7378 "wl:" wl-summary-buffer-folder-name
7033 "#" message-id))))) 7379 "#" message-id)))))
7034 7380
7381 ((or (equal major-mode 'mh-folder-mode)
7382 (equal major-mode 'mh-show-mode))
7383 (let ((from-header (org-mhe-get-header "From:"))
7384 (to-header (org-mhe-get-header "To:"))
7385 (subject (org-mhe-get-header "Subject:")))
7386 (setq cpltxt (concat from-header " on: " subject))
7387 (setq link (concat cpltxt "\n "
7388 (org-make-link
7389 "mhe:" (org-mhe-get-message-real-folder) "#"
7390 (org-remove-angle-brackets
7391 (org-mhe-get-header "Message-Id:")))))))
7392
7035 ((eq major-mode 'rmail-mode) 7393 ((eq major-mode 'rmail-mode)
7036 (save-excursion 7394 (save-excursion
7037 (save-restriction 7395 (save-restriction
@@ -7040,6 +7398,7 @@ For file links, arg negates `org-context-in-file-links'."
7040 (message-id (mail-fetch-field "message-id")) 7398 (message-id (mail-fetch-field "message-id"))
7041 (author (mail-fetch-field "from")) 7399 (author (mail-fetch-field "from"))
7042 (subject (mail-fetch-field "subject"))) 7400 (subject (mail-fetch-field "subject")))
7401 (setq message-id (org-remove-angle-brackets message-id))
7043 (setq cpltxt (concat author " on: " subject)) 7402 (setq cpltxt (concat author " on: " subject))
7044 (setq link (concat cpltxt "\n " 7403 (setq link (concat cpltxt "\n "
7045 (org-make-link 7404 (org-make-link
@@ -7093,19 +7452,26 @@ For file links, arg negates `org-context-in-file-links'."
7093 (abbreviate-file-name (buffer-file-name)))) 7452 (abbreviate-file-name (buffer-file-name))))
7094 ;; Add a context search string 7453 ;; Add a context search string
7095 (when (org-xor org-context-in-file-links arg) 7454 (when (org-xor org-context-in-file-links arg)
7455 ;; Check if we are on a target
7096 (if (save-excursion 7456 (if (save-excursion
7097 (skip-chars-backward "a-zA-Z<") 7457 (skip-chars-forward "^>\n\r")
7098 (looking-at (concat "<<\\(" org-camel-regexp "\\)>>"))) 7458 (and (re-search-backward "<<" nil t)
7459 (looking-at "<<\\(.*?\\)>>")
7460 (<= (match-beginning 0) pos)
7461 (>= (match-end 0) pos)))
7099 (setq cpltxt (concat cpltxt "::" (match-string 1))) 7462 (setq cpltxt (concat cpltxt "::" (match-string 1)))
7463 (setq txt (cond
7464 ((org-on-heading-p) nil)
7465 ((org-region-active-p)
7466 (buffer-substring (region-beginning) (region-end)))
7467 (t (buffer-substring (point-at-bol) (point-at-eol)))))
7100 (setq cpltxt 7468 (setq cpltxt
7101 (concat cpltxt "::" 7469 (concat cpltxt "::"
7102 (org-make-org-heading-camel 7470 (if org-file-link-context-use-camel-case
7103 (cond 7471 (org-make-org-heading-camel txt)
7104 ((org-on-heading-p) nil) 7472 (org-make-org-heading-search-string txt))))))
7105 ((org-region-active-p) 7473 (if (string-match "::\\'" cpltxt)
7106 (buffer-substring (region-beginning) (region-end))) 7474 (setq cpltxt (substring cpltxt 0 -2)))
7107 (t (buffer-substring (point-at-bol) (point-at-eol))))
7108 )))))
7109 (setq link (org-make-link cpltxt))) 7475 (setq link (org-make-link cpltxt)))
7110 7476
7111 ((buffer-file-name) 7477 ((buffer-file-name)
@@ -7114,12 +7480,14 @@ For file links, arg negates `org-context-in-file-links'."
7114 (abbreviate-file-name (buffer-file-name)))) 7480 (abbreviate-file-name (buffer-file-name))))
7115 ;; Add a context string 7481 ;; Add a context string
7116 (when (org-xor org-context-in-file-links arg) 7482 (when (org-xor org-context-in-file-links arg)
7483 (setq txt (if (org-region-active-p)
7484 (buffer-substring (region-beginning) (region-end))
7485 (buffer-substring (point-at-bol) (point-at-eol))))
7117 (setq cpltxt 7486 (setq cpltxt
7118 (concat cpltxt "::" 7487 (concat cpltxt "::"
7119 (org-make-org-heading-camel 7488 (if org-file-link-context-use-camel-case
7120 (if (org-region-active-p) 7489 (org-make-org-heading-camel txt)
7121 (buffer-substring (region-beginning) (region-end)) 7490 (org-make-org-heading-search-string txt)))))
7122 (buffer-substring (point-at-bol) (point-at-eol)))))))
7123 (setq link (org-make-link cpltxt))) 7491 (setq link (org-make-link cpltxt)))
7124 7492
7125 ((interactive-p) 7493 ((interactive-p)
@@ -7134,14 +7502,37 @@ For file links, arg negates `org-context-in-file-links'."
7134 (message "Stored: %s" (or cpltxt link))) 7502 (message "Stored: %s" (or cpltxt link)))
7135 link))) 7503 link)))
7136 7504
7137(defun org-make-org-heading-camel (&optional string) 7505(defun org-make-org-heading-search-string (&optional string heading)
7138 "Make a CamelCase string for S or the current headline." 7506 "Make search string for STRING or current headline."
7139 (interactive) 7507 (interactive)
7140 (let ((s (or string (org-get-heading)))) 7508 (let ((s (or string (org-get-heading))))
7141 (unless string 7509 (unless (and string (not heading))
7142 ;; We are using a headline, clean up garbage in there. 7510 ;; We are using a headline, clean up garbage in there.
7143 (if (string-match org-todo-regexp s) 7511 (if (string-match org-todo-regexp s)
7144 (setq s (replace-match "" t t s))) 7512 (setq s (replace-match "" t t s)))
7513 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
7514 (setq s (replace-match "" t t s)))
7515 (setq s (org-trim s))
7516 (if (string-match (concat "^\\(" org-quote-string "\\|"
7517 org-comment-string "\\)") s)
7518 (setq s (replace-match "" t t s)))
7519 (while (string-match org-ts-regexp s)
7520 (setq s (replace-match "" t t s))))
7521 (while (string-match "[^a-zA-Z_0-9 \t]+" s)
7522 (setq s (replace-match " " t t s)))
7523 (or string (setq s (concat "*" s))) ; Add * for headlines
7524 (mapconcat 'identity (org-split-string s "[ \t]+") " ")))
7525
7526(defun org-make-org-heading-camel (&optional string heading)
7527 "Make a CamelCase string for STRING or the current headline."
7528 (interactive)
7529 (let ((s (or string (org-get-heading))))
7530 (unless (and string (not heading))
7531 ;; We are using a headline, clean up garbage in there.
7532 (if (string-match org-todo-regexp s)
7533 (setq s (replace-match "" t t s)))
7534 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
7535 (setq s (replace-match "" t t s)))
7145 (setq s (org-trim s)) 7536 (setq s (org-trim s))
7146 (if (string-match (concat "^\\(" org-quote-string "\\|" 7537 (if (string-match (concat "^\\(" org-quote-string "\\|"
7147 org-comment-string "\\)") s) 7538 org-comment-string "\\)") s)
@@ -7157,6 +7548,12 @@ For file links, arg negates `org-context-in-file-links'."
7157 "Concatenate STRINGS, format resulting string with `org-link-format'." 7548 "Concatenate STRINGS, format resulting string with `org-link-format'."
7158 (format org-link-format (apply 'concat strings))) 7549 (format org-link-format (apply 'concat strings)))
7159 7550
7551(defun org-make-link2 (link &optional description)
7552 "Make a link with brackets."
7553 (concat "[[" link "]"
7554 (if description (concat "[" description "]") "")
7555 "]"))
7556
7160(defun org-xor (a b) 7557(defun org-xor (a b)
7161 "Exclusive or." 7558 "Exclusive or."
7162 (if a (not b) b)) 7559 (if a (not b) b))
@@ -7245,15 +7642,18 @@ is in the current directory or below."
7245 (let* ((path (match-string 1 link)) 7642 (let* ((path (match-string 1 link))
7246 (case-fold-search nil) 7643 (case-fold-search nil)
7247 (search (match-string 2 link))) 7644 (search (match-string 2 link)))
7248 (when (save-match-data 7645 (when (save-match-data
7249 (equal (file-truename (buffer-file-name)) 7646 (equal (file-truename (buffer-file-name))
7250 (file-truename path))) 7647 (file-truename path)))
7251 (if (save-match-data 7648 ;; We are linking to this same file
7252 (string-match (concat "^" org-camel-regexp "$") search)) 7649 (if (and org-file-link-context-use-camel-case
7253 (setq link (replace-match search t t link) 7650 (save-match-data
7254 matched t) 7651 (string-match (concat "^" org-camel-regexp "$") search)))
7255 (setq link (replace-match (concat "<file:::" search ">") 7652 (setq link (replace-match search t t link)
7256 t t link)))))) 7653 matched t)
7654 (setq link (replace-match (concat "[[" search "]]")
7655 t t link)
7656 matched t)))))
7257 (let ((lines (org-split-string link "\n"))) 7657 (let ((lines (org-split-string link "\n")))
7258 (insert (car lines)) 7658 (insert (car lines))
7259 (setq matched (or matched (string-match org-link-regexp (car lines)))) 7659 (setq matched (or matched (string-match org-link-regexp (car lines))))
@@ -8241,8 +8641,8 @@ Point and mark define the first and last line to include. Both point and
8241mark should be in the column that is used for sorting. For example, to 8641mark should be in the column that is used for sorting. For example, to
8242sort according to column 3, put the mark in the first line to sort, in 8642sort according to column 3, put the mark in the first line to sort, in
8243table column 3. Put point into the last line to be included in the sorting, 8643table column 3. Put point into the last line to be included in the sorting,
8244also in table column 3. The command will prompt for the sorting method (n for 8644also in table column 3. The command will prompt for the sorting method
8245numerical, a for alphanumeric)." 8645\(n for numerical, a for alphanumeric)."
8246 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ") 8646 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ")
8247 (setq numericp (string-match "[nN]" numericp)) 8647 (setq numericp (string-match "[nN]" numericp))
8248 (org-table-align) ;; Just to be safe 8648 (org-table-align) ;; Just to be safe
@@ -9081,8 +9481,8 @@ not overwrite the stored one."
9081 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n)) 9481 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n))
9082 (setq modes (org-set-calc-mode 9482 (setq modes (org-set-calc-mode
9083 'calc-float-format 9483 'calc-float-format
9084 (list (cdr (assoc c '((?n. float) (?f. fix) 9484 (list (cdr (assoc c '((?n . float) (?f . fix)
9085 (?s. sci) (?e. eng)))) 9485 (?s . sci) (?e . eng))))
9086 n)))) 9486 n))))
9087 (setq fmt (replace-match "" t t fmt))) 9487 (setq fmt (replace-match "" t t fmt)))
9088 (while (string-match "[DRFS]" fmt) 9488 (while (string-match "[DRFS]" fmt)
@@ -9467,9 +9867,8 @@ table editor in arbitrary modes.")
9467 (and c (setq minor-mode-map-alist 9867 (and c (setq minor-mode-map-alist
9468 (cons c (delq c minor-mode-map-alist))))) 9868 (cons c (delq c minor-mode-map-alist)))))
9469 (set (make-local-variable (quote org-table-may-need-update)) t) 9869 (set (make-local-variable (quote org-table-may-need-update)) t)
9470 (make-local-hook (quote before-change-functions)) ; needed for XEmacs 9870 (org-add-hook 'before-change-functions 'org-before-change-function
9471 (add-hook 'before-change-functions 'org-before-change-function 9871 nil 'local)
9472 nil 'local)
9473 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) 9872 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
9474 auto-fill-inhibit-regexp) 9873 auto-fill-inhibit-regexp)
9475 (set (make-local-variable 'auto-fill-inhibit-regexp) 9874 (set (make-local-variable 'auto-fill-inhibit-regexp)
@@ -9734,6 +10133,10 @@ a reduced column width."
9734 ((string-match "^#" line) 10133 ((string-match "^#" line)
9735 ;; an ordinary comment line 10134 ;; an ordinary comment line
9736 ) 10135 )
10136 ((and org-export-table-remove-special-lines
10137 (string-match "^[ \t]*| *[!_^] *|" line))
10138 ;; a special table line that should be removed
10139 )
9737 (t (setq rtn (cons line rtn))))) 10140 (t (setq rtn (cons line rtn)))))
9738 (nreverse rtn))) 10141 (nreverse rtn)))
9739 10142
@@ -10040,6 +10443,45 @@ The list contains HTML entities for Latin-1, Greek and other symbols.
10040It is supplemented by a number of commonly used TeX macros with appropriate 10443It is supplemented by a number of commonly used TeX macros with appropriate
10041translations. There is currently no way for users to extend this.") 10444translations. There is currently no way for users to extend this.")
10042 10445
10446(defun org-cleaned-string-for-export (string)
10447 "Cleanup a buffer substring so that links can be created safely."
10448 (interactive)
10449 (let* ((cb (current-buffer))
10450 (re-radio (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))
10451 rtn)
10452 (save-excursion
10453 (set-buffer (get-buffer-create " org-mode-tmp"))
10454 (erase-buffer)
10455 (insert string)
10456 (org-mode)
10457 ;; Find targets in comments and move them out of comments
10458 (goto-char (point-min))
10459 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
10460 (replace-match "\\1"))
10461 ;; Find matches for radio targets and turn them into links
10462 (goto-char (point-min))
10463 (while (re-search-forward re-radio nil t)
10464 (replace-match "\\1[[\\2]]"))
10465 ;; Find all links that contain a newline and put them into a single line
10466 (goto-char (point-min))
10467 (while (re-search-forward "\\(\\[\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\]\\)" nil t)
10468 (replace-match "\\1 \\2")
10469 (goto-char (match-beginning 0)))
10470 ;; Remove comments
10471 (goto-char (point-min))
10472 (while (re-search-forward "^#.*\n?" nil t)
10473 (replace-match ""))
10474 (setq rtn (buffer-string)))
10475 (kill-buffer " org-mode-tmp")
10476 rtn))
10477
10478(defun org-solidify-link-text (s)
10479 "Take link text and make a safe target out of it."
10480 (save-match-data
10481 (mapconcat
10482 'identity
10483 (org-split-string s "[ \t\r\n]+") "--")))
10484
10043(defvar org-last-level nil) ; dynamically scoped variable 10485(defvar org-last-level nil) ; dynamically scoped variable
10044 10486
10045(defun org-export-as-ascii (arg) 10487(defun org-export-as-ascii (arg)
@@ -10054,7 +10496,10 @@ underlined headlines. The default is 3."
10054 (if (org-region-active-p) (region-beginning) (point-min)) 10496 (if (org-region-active-p) (region-beginning) (point-min))
10055 (if (org-region-active-p) (region-end) (point-max)))) 10497 (if (org-region-active-p) (region-end) (point-max))))
10056 (lines (org-export-find-first-heading-line 10498 (lines (org-export-find-first-heading-line
10057 (org-skip-comments (org-split-string region "[\r\n]")))) 10499 (org-skip-comments
10500 (org-split-string
10501 (org-cleaned-string-for-export region)
10502 "[\r\n]"))))
10058 (org-startup-with-deadline-check nil) 10503 (org-startup-with-deadline-check nil)
10059 (level 0) line txt 10504 (level 0) line txt
10060 (umax nil) 10505 (umax nil)
@@ -10143,6 +10588,14 @@ underlined headlines. The default is 3."
10143 (while (setq line (pop lines)) 10588 (while (setq line (pop lines))
10144 ;; Remove the quoted HTML tags. 10589 ;; Remove the quoted HTML tags.
10145 (setq line (org-html-expand-for-ascii line)) 10590 (setq line (org-html-expand-for-ascii line))
10591 ;; Remove targets
10592 (while (string-match "<<<?[^<>]*>>>?[ \t]*\n?" line)
10593 (setq line (replace-match "" t t line)))
10594 ;; Replace internal links
10595 (while (string-match org-bracket-link-regexp line)
10596 (setq line (replace-match
10597 (if (match-end 3) "[\\3]" "[\\1]")
10598 t nil line)))
10146 (cond 10599 (cond
10147 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) 10600 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
10148 ;; a Headline 10601 ;; a Headline
@@ -10381,7 +10834,9 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10381 (if region-p (region-beginning) (point-min)) 10834 (if region-p (region-beginning) (point-min))
10382 (if region-p (region-end) (point-max)))) 10835 (if region-p (region-end) (point-max))))
10383 (all_lines 10836 (all_lines
10384 (org-skip-comments (org-split-string region "[\r\n]"))) 10837 (org-skip-comments (org-split-string
10838 (org-cleaned-string-for-export region)
10839 "[\r\n]")))
10385 (lines (org-export-find-first-heading-line all_lines)) 10840 (lines (org-export-find-first-heading-line all_lines))
10386 (level 0) (line "") (origline "") txt todo 10841 (level 0) (line "") (origline "") txt todo
10387 (umax nil) 10842 (umax nil)
@@ -10544,7 +10999,26 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10544 (insert "</pre>\n")) 10999 (insert "</pre>\n"))
10545 (throw 'nextline nil)) 11000 (throw 'nextline nil))
10546 11001
10547 ;; Protect the links 11002
11003 ;; make targets to anchors
11004 (while (string-match "<<<?\\([^<>]*\\)>>>?[ \t]*\n?" line)
11005 (setq line (replace-match
11006 (concat "@<a name=\""
11007 (org-solidify-link-text (match-string 1 line))
11008 "\">\\nbsp@</a>")
11009 t t line)))
11010 ;; Replace internal links
11011 (while (string-match org-bracket-link-regexp line)
11012 (setq line (replace-match
11013 (concat
11014 "@<a href=\"#"
11015 (org-solidify-link-text (match-string 1 line))
11016 "\">"
11017 (match-string (if (match-end 3) 3 1) line)
11018 "@</a>")
11019 t t line)))
11020
11021 ;; Protect the external links
10548 (setq start 0) 11022 (setq start 0)
10549 (while (string-match org-link-maybe-angles-regexp line start) 11023 (while (string-match org-link-maybe-angles-regexp line start)
10550 (setq start (match-end 0)) 11024 (setq start (match-end 0))
@@ -10587,7 +11061,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10587 (concat "<a href=\"" thefile "\">\\1:\\2</a>")) 11061 (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
10588 nil nil line)))) 11062 nil nil line))))
10589 11063
10590 ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell")) 11064 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
10591 (setq line (replace-match 11065 (setq line (replace-match
10592 "<i>&lt;\\1:\\2&gt;</i>" nil nil line))))) 11066 "<i>&lt;\\1:\\2&gt;</i>" nil nil line)))))
10593 11067
@@ -10722,11 +11196,34 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10722 (org-format-table-table-html-using-table-generate-source olines))))) 11196 (org-format-table-table-html-using-table-generate-source olines)))))
10723 11197
10724(defun org-format-org-table-html (lines) 11198(defun org-format-org-table-html (lines)
10725 "Format a table into html." 11199 "Format a table into HTML."
10726 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) 11200 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
10727 (setq lines (nreverse lines)) 11201 (setq lines (nreverse lines))
10728 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) 11202 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
10729 (setq lines (nreverse lines)) 11203 (setq lines (nreverse lines))
11204 (when org-export-table-remove-special-lines
11205 ;; Check if the table has a marking column. If yes remove the
11206 ;; column and the special lines
11207 (let* ((special
11208 (not
11209 (memq nil
11210 (mapcar
11211 (lambda (x)
11212 (or (string-match "^[ \t]*|-" x)
11213 (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
11214 lines)))))
11215 (if special
11216 (setq lines
11217 (delq nil
11218 (mapcar
11219 (lambda (x)
11220 (if (string-match "^[ \t]*| *[!_^] *|" x)
11221 nil ; ignore this line
11222 (and (or (string-match "^[ \t]*|-+\\+" x)
11223 (string-match "^[ \t]*|[^|]*|" x))
11224 (replace-match "|" t t x))))
11225 lines))))))
11226
10730 (let ((head (and org-export-highlight-first-table-line 11227 (let ((head (and org-export-highlight-first-table-line
10731 (delq nil (mapcar 11228 (delq nil (mapcar
10732 (lambda (x) (string-match "^[ \t]*|-" x)) 11229 (lambda (x) (string-match "^[ \t]*|-" x))
@@ -10765,7 +11262,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10765 newstr)) 11262 newstr))
10766 11263
10767(defun org-format-table-table-html (lines) 11264(defun org-format-table-table-html (lines)
10768 "Format a table generated by table.el into html. 11265 "Format a table generated by table.el into HTML.
10769This conversion does *not* use `table-generate-source' from table.el. 11266This conversion does *not* use `table-generate-source' from table.el.
10770This has the advantage that Org-mode's HTML conversions can be used. 11267This has the advantage that Org-mode's HTML conversions can be used.
10771But it has the disadvantage, that no cell- or row-spanning is allowed." 11268But it has the disadvantage, that no cell- or row-spanning is allowed."
@@ -11210,10 +11707,10 @@ a time), or the day by one (if it does not contain a time)."
11210 11707
11211;; - Bindings in Org-mode map are currently 11708;; - Bindings in Org-mode map are currently
11212;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet 11709;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet
11213;; abcd fgh j lmnopqrstuvwxyz!? #$ -+*/= [] ; |,.<>~ \t necessary bindings 11710;; abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/= [] ; |,.<>~ '\t necessary bindings
11214;; e (?) useful from outline-mode 11711;; e (?) useful from outline-mode
11215;; i k @ expendable from outline-mode 11712;; i k @ expendable from outline-mode
11216;; 0123456789 %^& ()_{} " `' free 11713;; 0123456789 % & ()_{} " ` free
11217 11714
11218;; Make `C-c C-x' a prefix key 11715;; Make `C-c C-x' a prefix key
11219(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) 11716(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
@@ -11281,6 +11778,8 @@ a time), or the day by one (if it does not contain a time)."
11281(define-key org-mode-map "\M-\C-m" 'org-insert-heading) 11778(define-key org-mode-map "\M-\C-m" 'org-insert-heading)
11282(define-key org-mode-map "\C-c\C-l" 'org-insert-link) 11779(define-key org-mode-map "\C-c\C-l" 'org-insert-link)
11283(define-key org-mode-map "\C-c\C-o" 'org-open-at-point) 11780(define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
11781(define-key org-mode-map "\C-c%" 'org-mark-ring-push)
11782(define-key org-mode-map "\C-c&" 'org-mark-ring-goto)
11284(define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding 11783(define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding
11285(define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved 11784(define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved
11286(define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r. 11785(define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
@@ -11594,6 +12093,7 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
11594 (interactive "P") 12093 (interactive "P")
11595 (let ((org-enable-table-editor t)) 12094 (let ((org-enable-table-editor t))
11596 (cond 12095 (cond
12096 ((org-on-target-p) (org-update-radio-target-regexp))
11597 ((org-on-heading-p) (org-set-tags arg)) 12097 ((org-on-heading-p) (org-set-tags arg))
11598 ((org-at-table.el-p) 12098 ((org-at-table.el-p)
11599 (require 'table) 12099 (require 'table)
@@ -11935,6 +12435,12 @@ work correctly."
11935 12435
11936;; Functions needed for Emacs/XEmacs region compatibility 12436;; Functions needed for Emacs/XEmacs region compatibility
11937 12437
12438(defun org-add-hook (hook function &optional append local)
12439 "Add-hook, compatible with both Emacsen."
12440 (if (and local org-xemacs-p)
12441 (add-local-hook hook function append)
12442 (add-hook hook function append local)))
12443
11938(defun org-region-active-p () 12444(defun org-region-active-p ()
11939 "Is `transient-mark-mode' on and the region active? 12445 "Is `transient-mark-mode' on and the region active?
11940Works on both Emacs and XEmacs." 12446Works on both Emacs and XEmacs."
@@ -12030,6 +12536,19 @@ to a visible line beginning. This makes the function of C-a more intuitive."
12030 (skip-chars-backward "^\r\n") 12536 (skip-chars-backward "^\r\n")
12031 (equal (char-before) ?\r)))) 12537 (equal (char-before) ?\r))))
12032 12538
12539(defun org-invisible-p2 ()
12540 "Check if point is at a character currently not visible."
12541 (save-excursion
12542 (if org-noutline-p
12543 (progn
12544 (if (and (eolp) (not (bobp))) (backward-char 1))
12545 ;; Early versions of noutline don't have `outline-invisible-p'.
12546 (if (fboundp 'outline-invisible-p)
12547 (outline-invisible-p)
12548 (get-char-property (point) 'invisible)))
12549 (skip-chars-backward "^\r\n")
12550 (equal (char-before) ?\r))))
12551
12033(defun org-back-to-heading (&optional invisible-ok) 12552(defun org-back-to-heading (&optional invisible-ok)
12034 "Move to previous heading line, or beg of this line if it's a heading. 12553 "Move to previous heading line, or beg of this line if it's a heading.
12035Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." 12554Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
@@ -12058,6 +12577,16 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
12058 (bobp) 12577 (bobp)
12059 (equal (char-before) ?\n)))))) 12578 (equal (char-before) ?\n))))))
12060 12579
12580(defun org-on-target-p ()
12581 (let ((pos (point)))
12582 (save-excursion
12583 (skip-chars-forward "<")
12584 (and (re-search-backward "<<" nil t)
12585 (or (looking-at org-target-regexp)
12586 (looking-at org-radio-target-regexp))
12587 (<= (match-beginning 0) pos)
12588 (>= (match-end 0) pos)))))
12589
12061(defun org-up-heading-all (arg) 12590(defun org-up-heading-all (arg)
12062 "Move to the heading line of which the present line is a subheading. 12591 "Move to the heading line of which the present line is a subheading.
12063This function considers both visible and invisible heading lines. 12592This function considers both visible and invisible heading lines.
@@ -12195,4 +12724,3 @@ Show the heading too, if it is currently invisible."
12195;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 12724;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12196;;; org.el ends here 12725;;; org.el ends here
12197 12726
12198
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index ff044230803..394a0b52b19 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index c6f43a07d26..ced44757ffd 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index 7546c654f70..1e60b8e663e 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7;; 7;;
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -33,7 +33,7 @@
33(require 'reftex) 33(require 'reftex)
34;;; 34;;;
35 35
36(defun reftex-view-crossref (&optional arg auto-how) 36(defun reftex-view-crossref (&optional arg auto-how fail-quietly)
37 "View cross reference of macro at point. Point must be on the KEY 37 "View cross reference of macro at point. Point must be on the KEY
38argument. When at at `\\ref' macro, show corresponding `\\label' 38argument. When at at `\\ref' macro, show corresponding `\\label'
39definition, also in external documents (`xr'). When on a label, show 39definition, also in external documents (`xr'). When on a label, show
@@ -56,52 +56,53 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
56 dw) 56 dw)
57 57
58 (if (or (null macro) (reftex-in-comment)) 58 (if (or (null macro) (reftex-in-comment))
59 (error "Not on a crossref macro argument")) 59 (or fail-quietly
60 60 (error "Not on a crossref macro argument"))
61 (setq reftex-call-back-to-this-buffer (current-buffer)) 61
62 62 (setq reftex-call-back-to-this-buffer (current-buffer))
63 (cond 63
64 ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro) 64 (cond
65 ;; A citation macro: search for bibitems or BibTeX entries 65 ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro)
66 (setq dw (reftex-view-cr-cite arg key auto-how))) 66 ;; A citation macro: search for bibitems or BibTeX entries
67 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) 67 (setq dw (reftex-view-cr-cite arg key auto-how)))
68 ;; A reference macro: search for labels 68 ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro)
69 (setq dw (reftex-view-cr-ref arg key auto-how))) 69 ;; A reference macro: search for labels
70 (auto-how nil) ;; No further action for automatic display (speed) 70 (setq dw (reftex-view-cr-ref arg key auto-how)))
71 ((or (equal macro "\\label") 71 (auto-how nil) ;; No further action for automatic display (speed)
72 (member macro reftex-macros-with-labels)) 72 ((or (equal macro "\\label")
73 ;; A label macro: search for reference macros 73 (member macro reftex-macros-with-labels))
74 (reftex-access-scan-info arg) 74 ;; A label macro: search for reference macros
75 (setq dw (reftex-view-regexp-match 75 (reftex-access-scan-info arg)
76 (format reftex-find-reference-format (regexp-quote key)) 76 (setq dw (reftex-view-regexp-match
77 4 nil nil))) 77 (format reftex-find-reference-format (regexp-quote key))
78 ((equal macro "\\bibitem") 78 4 nil nil)))
79 ;; A bibitem macro: search for citations 79 ((equal macro "\\bibitem")
80 (reftex-access-scan-info arg) 80 ;; A bibitem macro: search for citations
81 (setq dw (reftex-view-regexp-match 81 (reftex-access-scan-info arg)
82 (format reftex-find-citation-regexp-format (regexp-quote key)) 82 (setq dw (reftex-view-regexp-match
83 4 nil nil))) 83 (format reftex-find-citation-regexp-format (regexp-quote key))
84 ((member macro reftex-macros-with-index) 84 4 nil nil)))
85 (reftex-access-scan-info arg) 85 ((member macro reftex-macros-with-index)
86 (setq dw (reftex-view-regexp-match 86 (reftex-access-scan-info arg)
87 (format reftex-find-index-entry-regexp-format 87 (setq dw (reftex-view-regexp-match
88 (regexp-quote key)) 88 (format reftex-find-index-entry-regexp-format
89 3 nil nil))) 89 (regexp-quote key))
90 (t 90 3 nil nil)))
91 (reftex-access-scan-info arg) 91 (t
92 (catch 'exit 92 (reftex-access-scan-info arg)
93 (let ((list reftex-view-crossref-extra) 93 (catch 'exit
94 entry mre action group) 94 (let ((list reftex-view-crossref-extra)
95 (while (setq entry (pop list)) 95 entry mre action group)
96 (setq mre (car entry) 96 (while (setq entry (pop list))
97 action (nth 1 entry) 97 (setq mre (car entry)
98 group (nth 2 entry)) 98 action (nth 1 entry)
99 (when (string-match mre macro) 99 group (nth 2 entry))
100 (setq dw (reftex-view-regexp-match 100 (when (string-match mre macro)
101 (format action key) group nil nil)) 101 (setq dw (reftex-view-regexp-match
102 (throw 'exit t)))) 102 (format action key) group nil nil))
103 (error "Not on a crossref macro argument")))) 103 (throw 'exit t))))
104 (if (and (eq arg 2) (windowp dw)) (select-window dw)))) 104 (error "Not on a crossref macro argument"))))
105 (if (and (eq arg 2) (windowp dw)) (select-window dw)))))
105 106
106(defun reftex-view-cr-cite (arg key how) 107(defun reftex-view-cr-cite (arg key how)
107 ;; View crossreference of a ref cite. HOW can have the values 108 ;; View crossreference of a ref cite. HOW can have the values
@@ -243,7 +244,7 @@ With argument, actually select the window showing the cross reference."
243 (not (memq last-command '(reftex-view-crossref 244 (not (memq last-command '(reftex-view-crossref
244 reftex-mouse-view-crossref))) 245 reftex-mouse-view-crossref)))
245 ;; Quick precheck if this might be a relevant spot 246 ;; Quick precheck if this might be a relevant spot
246 ;; FIXME: Can fail with backslash in comment 247 ;; `reftex-view-crossref' will do a more thorough check.
247 (save-excursion 248 (save-excursion
248 (search-backward "\\" nil t) 249 (search-backward "\\" nil t)
249 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)")) 250 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
@@ -252,9 +253,9 @@ With argument, actually select the window showing the cross reference."
252 (let ((current-prefix-arg nil)) 253 (let ((current-prefix-arg nil))
253 (cond 254 (cond
254 ((eq reftex-auto-view-crossref t) 255 ((eq reftex-auto-view-crossref t)
255 (reftex-view-crossref -1 'echo)) 256 (reftex-view-crossref -1 'echo 'quiet))
256 ((eq reftex-auto-view-crossref 'window) 257 ((eq reftex-auto-view-crossref 'window)
257 (reftex-view-crossref -1 'tmp-window)) 258 (reftex-view-crossref -1 'tmp-window 'quiet))
258 (t nil))) 259 (t nil)))
259 (error nil)))) 260 (error nil))))
260 261
@@ -267,7 +268,8 @@ With argument, actually select the window showing the cross reference."
267 ;; Display crossref info in echo area. 268 ;; Display crossref info in echo area.
268 (cond 269 (cond
269 ((null docstruct) 270 ((null docstruct)
270 (message "%s" (substitute-command-keys (format reftex-no-info-message "ref")))) 271 (message "%s"
272 (substitute-command-keys (format reftex-no-info-message "ref"))))
271 ((null entry) 273 ((null entry)
272 (message "ref: unknown label: %s" label)) 274 (message "ref: unknown label: %s" label))
273 (t 275 (t
@@ -301,7 +303,7 @@ With argument, actually select the window showing the cross reference."
301 (if (and files (= (length all-files) (length files))) 303 (if (and files (= (length all-files) (length files)))
302 (message "cite: no such database entry: %s" key) 304 (message "cite: no such database entry: %s" key)
303 (message "%s" (substitute-command-keys 305 (message "%s" (substitute-command-keys
304 (format reftex-no-info-message "cite")))) 306 (format reftex-no-info-message "cite"))))
305 nil))) 307 nil)))
306 (when entry 308 (when entry
307 (if item 309 (if item
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index fafc1a30998..e1ae98a59df 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index a7e7203a639..f005e7a3b87 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index ce43840c888..76eb7c31df8 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7;; 7;;
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index f1a8d6d3965..a850da3042e 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 9aa7edbf438..69a893ff177 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index f9eb3cfef82..9b710b92a67 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index b8eddcd0386..e866b03626f 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
@@ -1555,6 +1555,18 @@ TeX-file-extensions."
1555 :type '(repeat (cons (string :tag "File type") 1555 :type '(repeat (cons (string :tag "File type")
1556 (repeat (string :tag "Extension"))))) 1556 (repeat (string :tag "Extension")))))
1557 1557
1558(defcustom reftex-try-all-extensions nil
1559 "Non-nil means, try all extensions listed in `reftex-file-extensions'.
1560When searching for a file, LaTeX uses only the default extension. However,
1561if you are working with a noweb system that produces the .tex files from
1562some other file, and you want RefTeX to scan the web file instead of the
1563tex file, you need to set this option. You also need to make the noweb
1564extension the default extension, i.e. the first in the list in
1565`reftex-file-extensions'.
1566Note that if you are using external file finders, this option has no effect."
1567 :group 'reftex-finding-files
1568 :type 'boolean)
1569
1558(defcustom reftex-search-unrecursed-path-first t 1570(defcustom reftex-search-unrecursed-path-first t
1559 "*Non-nil means, search all specified directories before trying recursion. 1571 "*Non-nil means, search all specified directories before trying recursion.
1560Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then 1572Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index cb2e960225d..d759aff8774 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -3,7 +3,7 @@
3;; 2006 Free Software Foundation, Inc. 3;; 2006 Free Software Foundation, Inc.
4 4
5;; Author: Carsten Dominik <dominik@science.uva.nl> 5;; Author: Carsten Dominik <dominik@science.uva.nl>
6;; Version: VERSIONTAG 6;; Version: 4.31
7;; Keywords: tex 7;; Keywords: tex
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -301,7 +301,7 @@
301;;; Define the formal stuff for a minor mode named RefTeX. 301;;; Define the formal stuff for a minor mode named RefTeX.
302;;; 302;;;
303 303
304(defconst reftex-version "RefTeX version VERSIONTAG" 304(defconst reftex-version "RefTeX version 4.31"
305 "Version string for RefTeX.") 305 "Version string for RefTeX.")
306 306
307(defvar reftex-mode nil 307(defvar reftex-mode nil
@@ -1437,14 +1437,17 @@ When DIE is non-nil, throw an error if file not found."
1437 "\\)\\'")) 1437 "\\)\\'"))
1438 (files (if (string-match ext-re file) 1438 (files (if (string-match ext-re file)
1439 (cons file nil) 1439 (cons file nil)
1440 (cons (concat file def-ext) file))) 1440 (if reftex-try-all-extensions
1441 path old-path file1) 1441 (append (mapcar (lambda (x) (concat file x))
1442 extensions)
1443 (list file))
1444 (list (concat file def-ext) file))))
1445 path old-path file1 f fs)
1442 (cond 1446 (cond
1443 ((file-name-absolute-p file) 1447 ((file-name-absolute-p file)
1444 (setq file1 1448 (while (setq f (pop files))
1445 (or 1449 (if (file-regular-p f)
1446 (and (car files) (file-regular-p (car files)) (car files)) 1450 (setq file1 f files nil))))
1447 (and (cdr files) (file-regular-p (cdr files)) (cdr files)))))
1448 ((and reftex-use-external-file-finders 1451 ((and reftex-use-external-file-finders
1449 (assoc type reftex-external-file-finders)) 1452 (assoc type reftex-external-file-finders))
1450 (setq file1 (reftex-find-file-externally file type master-dir))) 1453 (setq file1 (reftex-find-file-externally file type master-dir)))
@@ -1452,16 +1455,13 @@ When DIE is non-nil, throw an error if file not found."
1452 (while (and (null file1) rec-values) 1455 (while (and (null file1) rec-values)
1453 (setq path (reftex-access-search-path 1456 (setq path (reftex-access-search-path
1454 type (pop rec-values) master-dir file)) 1457 type (pop rec-values) master-dir file))
1455 (if (or (null old-path) 1458 (setq fs files)
1456 (not (eq old-path path))) 1459 (while (and (null file1) (setq f (pop fs)))
1457 (setq old-path path 1460 (when (or (null old-path)
1458 path (cons master-dir path) 1461 (not (eq old-path path)))
1459 file1 (or (and (car files) 1462 (setq old-path path
1460 (reftex-find-file-on-path 1463 path (cons master-dir path))
1461 (car files) path master-dir)) 1464 (setq file1 (reftex-find-file-on-path f path master-dir)))))))
1462 (and (cdr files)
1463 (reftex-find-file-on-path
1464 (cdr files) path master-dir))))))))
1465 (cond (file1 file1) 1465 (cond (file1 file1)
1466 (die (error "No such file: %s" file) nil) 1466 (die (error "No such file: %s" file) nil)
1467 (t (message "No such file: %s (ignored)" file) nil)))) 1467 (t (message "No such file: %s (ignored)" file) nil))))