aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2006-02-23 03:17:52 +0000
committerKaroly Lorentey2006-02-23 03:17:52 +0000
commit5a5654159aeca7b60bfceb8d68f4add0570efc7a (patch)
treeeb9da5ea0ca4c025dc76a66eb1ede78a1cc88bc7 /lisp
parent5f3c1a63f31f77f60b8a60518ce3eda6a51f72b9 (diff)
parente75116edb6280346c671aa5a5c022776b0ca1c01 (diff)
downloademacs-5a5654159aeca7b60bfceb8d68f4add0570efc7a.tar.gz
emacs-5a5654159aeca7b60bfceb8d68f4add0570efc7a.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-111 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-112 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-113 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-114 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-115 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-518
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog97
-rw-r--r--lisp/abbrevlist.el1
-rw-r--r--lisp/calendar/appt.el1
-rw-r--r--lisp/ediff-diff.el5
-rw-r--r--lisp/emacs-lisp/unsafep.el17
-rw-r--r--lisp/files.el9
-rw-r--r--lisp/help.el8
-rw-r--r--lisp/isearch.el7
-rw-r--r--lisp/mh-e/ChangeLog5
-rw-r--r--lisp/mh-e/mh-e.el3
-rw-r--r--lisp/progmodes/gdb-ui.el58
-rw-r--r--lisp/progmodes/sh-script.el10
-rw-r--r--lisp/sort.el5
-rw-r--r--lisp/textmodes/org.el701
-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
25 files changed, 850 insertions, 251 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 32f4d243fce..fd03764b8d0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,100 @@
12006-02-23 Nick Roberts <nickrob@snap.net.nz>
2
3 * progmodes/gdb-ui.el (gdb-signalled): New variable and function.
4 (gdb-debug-log-ring): Rename from gdb-debug-log and make a ring.
5 (gdb-send, gdb-send-item, gud-gdba-marker-filter): Use it.
6 (gdb-debug-log-length): Customize it's length.
7 (gud-watch, gdb-var-create-handler): Display function::var format
8 but don't use to create variable object.
9 (gdb-var-create-handler): Use message-box in place of message.
10 (gdb-stopped): Call gdb-exited if signalled.
11
122006-02-22 Carsten Dominik <dominik@science.uva.nl>
13
14 * textmodes/reftex.el (reftex-locate-file): Removed duplicate
15 function.
16
17 * textmodes/reftex-vars.el: (reftex-try-all-extensions): New
18 option.
19
20 * textmodes/reftex.el: (reftex-locate-file): Search all extensions
21 if `reftex-try-all-extensions' is set.
22
23 * textmodes/org.el: (org-mark-ring-previous, org-mark-ring-set):
24 New commands.
25 (org-mark-ring): New variable.
26 (org-mark-ring-length): New option.
27 (org-open-at-point, org-goto, org-open-file): Push old position
28 onto the mark ring.
29 (org-add-hook): New function.
30 (org-export-table-remove-special-lines): New option.
31 (org-skip-comments, org-format-org-table-html): Respect new option
32 `org-export-table-remove-special-lines'.
33 (org-open-file): Allow special command configuration for directory
34 link.
35 (org-file-apps): Fixed bugs in customize type, added setting for
36 directories.
37 (org-activate-tags, org-format-agenda-item, org-complete)
38 (org-get-tags-at, org-scan-tags, org-make-tags-matcher)
39 (org-get-tags, org-get-buffer-tags, org-open-at-point)
40 (org-link-search, org-make-org-heading-search-string)
41 (org-make-org-heading-camel): Allow @ and 0-9 as tags characters.
42 (org-radio-targets, org-file-link-context-use-camel-case)
43 (org-activate-camels): New options.
44 (org-update-radio-target-regexp, org-all-targets)
45 (org-make-target-link-regexp, org-activate-target-links): New
46 functions.
47 (org-make-org-heading-search-string): New function.
48 (org-store-link, org-insert-link): Use new option
49 `org-file-link-context-use-camel-case'.
50 (org-activate-camels): Use new option `org-activate-camels'.
51 (org-link-regexp): Added mhe prefix.
52 (org-open-at-point,org-store-link): Support for mhe links.
53 (org-mhe-get-message-id, org-mhe-get-message-folder)
54 (org-mhe-get-header,org-follow-mhe-link): New functions.
55 (org-remove-angle-brackets, org-add-angle-brackets): New
56 functions.
57 (org-bracked-link-regexp): New constant.
58 (org-read-date): Fixed bug that was rejecting all typed dates.
59 (org-link-search): Make hierarchy above visible after a match.
60 (org-follow-bbdb-link): Inhibit electric mode for BBDB.
61 (org-store-link): Fixed bug with link creation when cursor is in
62 an empty line.
63 (org-open-at-point): Fixed bug with matching a link. Fixed buggy
64 argument sequence in call to `org-view-tags'.
65 (org-compile-prefix-format): Set `org-prefix-has-tag'.
66 (org-prefix-has-tag): New variable.
67 (org-format-agenda-item): Remove tags from headline if
68 appropriate.
69 (org-agenda-remove-tags-when-in-prefix): New option.
70
712006-02-21 Michael Kifer <kifer@cs.stonybrook.edu>
72
73 * ediff-diff.el (ediff-setup-diff-regions, ediff-setup-diff-regions3):
74 fix the regular expressions.
75
762006-02-21 Richard M. Stallman <rms@gnu.org>
77
78 * progmodes/sh-script.el (sh-mode): Set shell type based on file name
79 if there's no other specific basis.
80
81 * emacs-lisp/unsafep.el (unsafep): Don't treat &rest or &optional
82 as variables at all.
83 (unsafep-variable): Rename arg; doc fix.
84
85 * abbrevlist.el (list-one-abbrev-table): Add autoload.
86
87 * calendar/appt.el (diary-selective-display): Add defvar.
88
89 * sort.el (sort-columns): Use Posix arg syntax for `sort'.
90
91 * isearch.el (search-whitespace-regexp): Fix custom type.
92
93 * help.el (describe-key-briefly): Compute interactive args
94 in same was as before previous change.
95
96 * files.el (enable-local-variables): Doc fix.
97
12006-02-21 Kim F. Storm <storm@cua.dk> 982006-02-21 Kim F. Storm <storm@cua.dk>
2 99
3 * fringe.el: Cleanup as file is now pre-loaded. 100 * fringe.el: Cleanup as file is now pre-loaded.
diff --git a/lisp/abbrevlist.el b/lisp/abbrevlist.el
index bd3482f974b..d52ccffeb3c 100644
--- a/lisp/abbrevlist.el
+++ b/lisp/abbrevlist.el
@@ -28,6 +28,7 @@
28 28
29;;; Code: 29;;; Code:
30 30
31;;;###autoload
31(defun list-one-abbrev-table (abbrev-table output-buffer) 32(defun list-one-abbrev-table (abbrev-table output-buffer)
32 "Display alphabetical listing of ABBREV-TABLE in buffer OUTPUT-BUFFER." 33 "Display alphabetical listing of ABBREV-TABLE in buffer OUTPUT-BUFFER."
33 (with-output-to-temp-buffer output-buffer 34 (with-output-to-temp-buffer output-buffer
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 571b4ec132a..bce30a1de20 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -78,6 +78,7 @@
78;; Make sure calendar is loaded when we compile this. 78;; Make sure calendar is loaded when we compile this.
79(require 'calendar) 79(require 'calendar)
80 80
81(defvar diary-selective-display)
81 82
82;;;###autoload 83;;;###autoload
83(defcustom appt-issue-message t 84(defcustom appt-issue-message t
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/emacs-lisp/unsafep.el b/lisp/emacs-lisp/unsafep.el
index 41e98694c71..aeaf653aef6 100644
--- a/lisp/emacs-lisp/unsafep.el
+++ b/lisp/emacs-lisp/unsafep.el
@@ -148,10 +148,10 @@ of symbols with local bindings."
148 ((eq fun 'lambda) 148 ((eq fun 'lambda)
149 ;;First arg is temporary bindings 149 ;;First arg is temporary bindings
150 (mapc #'(lambda (x) 150 (mapc #'(lambda (x)
151 (let ((y (unsafep-variable x t)))
152 (if y (throw 'unsafep y)))
153 (or (memq x '(&optional &rest)) 151 (or (memq x '(&optional &rest))
154 (push x unsafep-vars))) 152 (let ((y (unsafep-variable x t)))
153 (if y (throw 'unsafep y))
154 (push x unsafep-vars))))
155 (cadr form)) 155 (cadr form))
156 (unsafep-progn (cddr form))) 156 (unsafep-progn (cddr form)))
157 ((eq fun 'let) 157 ((eq fun 'let)
@@ -247,17 +247,16 @@ and throws a reason to `unsafep' if unsafe. Returns SYM."
247 (if reason (throw 'unsafep reason)) 247 (if reason (throw 'unsafep reason))
248 sym)) 248 sym))
249 249
250(defun unsafep-variable (sym global-okay) 250(defun unsafep-variable (sym to-bind)
251 "Return nil if SYM is safe as a let-binding sym 251 "Return nil if SYM is safe to set or bind, or a reason why not.
252\(because it already has a temporary binding or is a non-risky buffer-local 252If TO-BIND is nil, check whether SYM is safe to set.
253variable), otherwise a reason why it is unsafe. Failing to be locally bound 253If TO-BIND is t, check whether SYM is safe to bind."
254is okay if GLOBAL-OKAY is non-nil."
255 (cond 254 (cond
256 ((not (symbolp sym)) 255 ((not (symbolp sym))
257 `(variable ,sym)) 256 `(variable ,sym))
258 ((risky-local-variable-p sym nil) 257 ((risky-local-variable-p sym nil)
259 `(risky-local-variable ,sym)) 258 `(risky-local-variable ,sym))
260 ((not (or global-okay 259 ((not (or to-bind
261 (memq sym unsafep-vars) 260 (memq sym unsafep-vars)
262 (local-variable-p sym))) 261 (local-variable-p sym)))
263 `(global-variable ,sym)))) 262 `(global-variable ,sym))))
diff --git a/lisp/files.el b/lisp/files.el
index 9cfaf557ec7..13cc7e7da10 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -447,10 +447,11 @@ use `before-save-hook'.")
447The value can be t, nil or something else. 447The value can be t, nil or something else.
448 448
449A value of t means file local variables specifications are obeyed 449A value of t means file local variables specifications are obeyed
450if all the specified variables are safe. If any variables are 450if all the specified variable values are safe; if any values are
451not safe, you will be queries before setting them. 451not safe, Emacs queries you, once, whether to set them all.
452A value of nil means file local variables are ignored. 452
453Any other value means to always query. 453A value of nil means always ignore the file local variables.
454Any other value means always query you once whether to set them all.
454 455
455This variable also controls use of major modes specified in 456This variable also controls use of major modes specified in
456a -*- line. 457a -*- line.
diff --git a/lisp/help.el b/lisp/help.el
index 02045948ecb..f74293b8dd6 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -579,12 +579,8 @@ temporarily enables it to allow getting help on disabled items and buttons."
579 (setq key (read-key-sequence "Describe key (or click or menu item): ")) 579 (setq key (read-key-sequence "Describe key (or click or menu item): "))
580 (list 580 (list
581 key 581 key
582 (prefix-numeric-value current-prefix-arg) 582 (if current-prefix-arg (prefix-numeric-value current-prefix-arg))
583 ;; If KEY is a down-event, read the corresponding up-event 583 1))
584 ;; and use it as the third argument.
585 (if (and (consp key) (symbolp (car key))
586 (memq 'down (cdr (get (car key) 'event-symbol-elements))))
587 (read-event))))
588 ;; Put yank-menu back as it was, if we changed it. 584 ;; Put yank-menu back as it was, if we changed it.
589 (when saved-yank-menu 585 (when saved-yank-menu
590 (setq yank-menu (copy-sequence saved-yank-menu)) 586 (setq yank-menu (copy-sequence saved-yank-menu))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index ace20881737..0a85f10cf40 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -116,8 +116,11 @@ When you put a space or spaces in the incremental regexp, it stands for
116this, unless it is inside of a regexp construct such as [...] or *, + or ?. 116this, unless it is inside of a regexp construct such as [...] or *, + or ?.
117You might want to use something like \"[ \\t\\r\\n]+\" instead. 117You might want to use something like \"[ \\t\\r\\n]+\" instead.
118In the Customization buffer, that is `[' followed by a space, 118In the Customization buffer, that is `[' followed by a space,
119a tab, a carriage return (control-M), a newline, and `]+'." 119a tab, a carriage return (control-M), a newline, and `]+'.
120 :type 'regexp 120
121When this is nil, each space you type matches literally, against one space."
122 :type '(choice (const :tag "Find Spaces Literally" nil)
123 regexp)
121 :group 'isearch) 124 :group 'isearch)
122 125
123(defcustom search-invisible 'open 126(defcustom search-invisible 'open
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index accb359bc38..a1043c6c6ee 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,8 @@
12006-02-21 Eric Ding <ericding@alum.mit.edu>
2
3 * mh-e.el (mh-invisible-header-fields-internal): Added entry
4 "X-Sasl-enc:"
5
12006-02-20 Eric Ding <ericding@alum.mit.edu> 62006-02-20 Eric Ding <ericding@alum.mit.edu>
2 7
3 * mh-e.el (mh-invisible-header-fields-internal): Added entries 8 * mh-e.el (mh-invisible-header-fields-internal): Added entries
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 134c88bec25..5a07524aec4 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -2395,7 +2395,8 @@ of citations entirely, choose \"None\"."
2395 "X-SBPass:" ; Spam 2395 "X-SBPass:" ; Spam
2396 "X-SBRule:" ; Spam 2396 "X-SBRule:" ; Spam
2397 "X-SMTP-" 2397 "X-SMTP-"
2398 "X-Scanned-By" 2398 "X-Sasl-enc:" ; Apple Mail
2399 "X-Scanned-By:"
2399 "X-Sender:" 2400 "X-Sender:"
2400 "X-Server-Date:" 2401 "X-Server-Date:"
2401 "X-Server-Uuid:" 2402 "X-Server-Uuid:"
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index df603dc0d74..7e0cda786c7 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,20 @@ 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-log-length 128
263 "Length of `gdb-debug-log-ring'."
264 :group 'gud
265 :type 'integer
266 :version "22.1")
267
268(defvar gdb-debug-log-ring (make-ring gdb-debug-log-length)
269 "Ring of commands sent to and replies received from GDB.
270This variable is used to debug GDB-UI. Just need most recent
271messages and a ring limits the size.")
262 272
263;;;###autoload 273;;;###autoload
264(defcustom gdb-enable-debug-log nil 274(defcustom gdb-enable-debug-log nil
265 "Non-nil means record the process input and output in `gdb-debug-log'." 275 "Non-nil means record the process input and output in `gdb-debug-log-ring'."
266 :type 'boolean 276 :type 'boolean
267 :group 'gud 277 :group 'gud
268 :version "22.1") 278 :version "22.1")
@@ -390,7 +400,6 @@ With arg, use separate IO iff arg is positive."
390 expr)) 400 expr))
391 401
392(defun gdb-init-1 () 402(defun gdb-init-1 ()
393 (setq gdb-debug-log nil)
394 (set (make-local-variable 'gud-minor-mode) 'gdba) 403 (set (make-local-variable 'gud-minor-mode) 'gdba)
395 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter) 404 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
396 ;; 405 ;;
@@ -469,14 +478,15 @@ With arg, use separate IO iff arg is positive."
469 gdb-source-file-list nil 478 gdb-source-file-list nil
470 gdb-error nil 479 gdb-error nil
471 gdb-macro-info nil 480 gdb-macro-info nil
472 gdb-buffer-fringe-width (car (window-fringes))) 481 gdb-buffer-fringe-width (car (window-fringes))
482 gdb-debug-log-ring (make-ring gdb-debug-log-length)
483 gdb-signalled nil)
473 484
474 (setq gdb-buffer-type 'gdba) 485 (setq gdb-buffer-type 'gdba)
475 486
476 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io)) 487 (if gdb-use-separate-io-buffer (gdb-clear-inferior-io))
477 488
478 ;; Hack to see test for GDB 6.4+ (-stack-info-frame was implemented in 6.4) 489 ;; 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" 490 (gdb-enqueue-input (list "server interpreter mi -stack-info-frame\n"
481 'gdb-get-version))) 491 'gdb-get-version)))
482 492
@@ -573,9 +583,6 @@ With arg, automatically raise speedbar iff arg is positive."
573 (require 'tooltip) 583 (require 'tooltip)
574 (save-selected-window 584 (save-selected-window
575 (let ((expr (tooltip-identifier-from-point (point)))) 585 (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 586 (catch 'already-watched
580 (dolist (var gdb-var-list) 587 (dolist (var gdb-var-list)
581 (if (string-equal expr (car var)) (throw 'already-watched nil))) 588 (if (string-equal expr (car var)) (throw 'already-watched nil)))
@@ -593,11 +600,15 @@ With arg, automatically raise speedbar iff arg is positive."
593(defun gdb-var-create-handler (expr) 600(defun gdb-var-create-handler (expr)
594 (goto-char (point-min)) 601 (goto-char (point-min))
595 (if (re-search-forward gdb-var-create-regexp nil t) 602 (if (re-search-forward gdb-var-create-regexp nil t)
596 (let ((var (list expr 603 (let ((var (list
597 (match-string 1) 604 (if (and (string-equal gdb-current-language "c")
598 (match-string 2) 605 gdb-use-colon-colon-notation gdb-selected-frame)
599 (match-string 3) 606 (setq expr (concat gdb-selected-frame "::" expr))
600 nil nil))) 607 expr)
608 (match-string 1)
609 (match-string 2)
610 (match-string 3)
611 nil nil)))
601 (push var gdb-var-list) 612 (push var gdb-var-list)
602 (speedbar 1) 613 (speedbar 1)
603 (unless (string-equal 614 (unless (string-equal
@@ -613,7 +624,7 @@ With arg, automatically raise speedbar iff arg is positive."
613 ,(nth 1 var) nil))))) 624 ,(nth 1 var) nil)))))
614 (if (search-forward "Undefined command" nil t) 625 (if (search-forward "Undefined command" nil t)
615 (message-box "Watching expressions requires gdb 6.0 onwards") 626 (message-box "Watching expressions requires gdb 6.0 onwards")
616 (message "No symbol \"%s\" in current context." expr)))) 627 (message-box "No symbol \"%s\" in current context." expr))))
617 628
618(defun gdb-var-evaluate-expression-handler (varnum changed) 629(defun gdb-var-evaluate-expression-handler (varnum changed)
619 (goto-char (point-min)) 630 (goto-char (point-min))
@@ -864,7 +875,7 @@ The key should be one of the cars in `gdb-buffer-rules-assoc'."
864 "*")) 875 "*"))
865 876
866(defun gdb-display-separate-io-buffer () 877(defun gdb-display-separate-io-buffer ()
867 "Display IO of inferior in a separate window." 878 "Display IO of debugged program in a separate window."
868 (interactive) 879 (interactive)
869 (if gdb-use-separate-io-buffer 880 (if gdb-use-separate-io-buffer
870 (gdb-display-buffer 881 (gdb-display-buffer
@@ -963,7 +974,7 @@ This filter may simply queue input for a later time."
963 (let ((item (concat string "\n"))) 974 (let ((item (concat string "\n")))
964 (if gud-running 975 (if gud-running
965 (progn 976 (progn
966 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log)) 977 (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log-ring))
967 (process-send-string proc item)) 978 (process-send-string proc item))
968 (gdb-enqueue-input item)))) 979 (gdb-enqueue-input item))))
969 980
@@ -986,7 +997,8 @@ This filter may simply queue input for a later time."
986 997
987(defun gdb-send-item (item) 998(defun gdb-send-item (item)
988 (setq gdb-flush-pending-output nil) 999 (setq gdb-flush-pending-output nil)
989 (if gdb-enable-debug-log (push (cons 'send-item item) gdb-debug-log)) 1000 (if gdb-enable-debug-log
1001 (ring-insert gdb-debug-log-ring (cons 'send-item item)))
990 (setq gdb-current-item item) 1002 (setq gdb-current-item item)
991 (let ((process (get-buffer-process gud-comint-buffer))) 1003 (let ((process (get-buffer-process gud-comint-buffer)))
992 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba) 1004 (if (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 'gdba)
@@ -1039,7 +1051,7 @@ This filter may simply queue input for a later time."
1039 ("source" gdb-source) 1051 ("source" gdb-source)
1040 ("starting" gdb-starting) 1052 ("starting" gdb-starting)
1041 ("exited" gdb-exited) 1053 ("exited" gdb-exited)
1042 ("signalled" gdb-exited) 1054 ("signalled" gdb-signalled)
1043 ("signal" gdb-stopping) 1055 ("signal" gdb-stopping)
1044 ("breakpoint" gdb-stopping) 1056 ("breakpoint" gdb-stopping)
1045 ("watchpoint" gdb-stopping) 1057 ("watchpoint" gdb-stopping)
@@ -1156,6 +1168,9 @@ directives."
1156 (setq gdb-overlay-arrow-position nil) 1168 (setq gdb-overlay-arrow-position nil)
1157 (gdb-stopping ignored)) 1169 (gdb-stopping ignored))
1158 1170
1171(defun gdb-signalled (ignored)
1172 (setq gdb-signalled t))
1173
1159(defun gdb-frame-begin (ignored) 1174(defun gdb-frame-begin (ignored)
1160 (let ((sink gdb-output-sink)) 1175 (let ((sink gdb-output-sink))
1161 (cond 1176 (cond
@@ -1172,7 +1187,6 @@ directives."
1172It is just like `gdb-stopping', except that if we already set the output 1187It is just like `gdb-stopping', except that if we already set the output
1173sink to `user' in `gdb-stopping', that is fine." 1188sink to `user' in `gdb-stopping', that is fine."
1174 (setq gud-running nil) 1189 (setq gud-running nil)
1175 (setq gdb-active-process t)
1176 (let ((sink gdb-output-sink)) 1190 (let ((sink gdb-output-sink))
1177 (cond 1191 (cond
1178 ((eq sink 'inferior) 1192 ((eq sink 'inferior)
@@ -1180,7 +1194,8 @@ sink to `user' in `gdb-stopping', that is fine."
1180 ((eq sink 'user) t) 1194 ((eq sink 'user) t)
1181 (t 1195 (t
1182 (gdb-resync) 1196 (gdb-resync)
1183 (error "Unexpected stopped annotation"))))) 1197 (error "Unexpected stopped annotation"))))
1198 (if gdb-signalled (gdb-exited ignored)))
1184 1199
1185(defun gdb-error (ignored) 1200(defun gdb-error (ignored)
1186 (setq gdb-error (not gdb-error))) 1201 (setq gdb-error (not gdb-error)))
@@ -1233,7 +1248,8 @@ happens to be appropriate."
1233 "A gud marker filter for gdb. Handle a burst of output from GDB." 1248 "A gud marker filter for gdb. Handle a burst of output from GDB."
1234 (if gdb-flush-pending-output 1249 (if gdb-flush-pending-output
1235 nil 1250 nil
1236 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) 1251 (if gdb-enable-debug-log
1252 (ring-insert gdb-debug-log-ring (cons 'recv string)))
1237 ;; Recall the left over gud-marker-acc from last time. 1253 ;; Recall the left over gud-marker-acc from last time.
1238 (setq gud-marker-acc (concat gud-marker-acc string)) 1254 (setq gud-marker-acc (concat gud-marker-acc string))
1239 ;; Start accumulating output for the GUD buffer. 1255 ;; Start accumulating output for the GUD buffer.
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index e331268391a..02ce4a21c97 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1438,6 +1438,16 @@ with your script for an edit-interpret-debug cycle."
1438 ((and buffer-file-name 1438 ((and buffer-file-name
1439 (string-match "\\.m?spec\\'" buffer-file-name)) 1439 (string-match "\\.m?spec\\'" buffer-file-name))
1440 "rpm"))))) 1440 "rpm")))))
1441 (unless interpreter
1442 (setq interpreter
1443 (cond ((string-match "[.]sh\\>" buffer-file-name)
1444 "sh")
1445 ((string-match "[.]bash\\>" buffer-file-name)
1446 "bash")
1447 ((string-match "[.]ksh\\>" buffer-file-name)
1448 "ksh")
1449 ((string-match "[.]csh\\>" buffer-file-name)
1450 "csh"))))
1441 (sh-set-shell (or interpreter sh-shell-file) nil nil)) 1451 (sh-set-shell (or interpreter sh-shell-file) nil nil))
1442 (run-mode-hooks 'sh-mode-hook)) 1452 (run-mode-hooks 'sh-mode-hook))
1443 1453
diff --git a/lisp/sort.el b/lisp/sort.el
index 174a8531786..5183bf65afa 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -499,8 +499,9 @@ Use \\[untabify] to convert tabs to spaces before sorting."
499 ;; in the region, since the sort utility would lose the 499 ;; in the region, since the sort utility would lose the
500 ;; properties. 500 ;; properties.
501 (let ((sort-args (list (if reverse "-rt\n" "-t\n") 501 (let ((sort-args (list (if reverse "-rt\n" "-t\n")
502 (concat "+0." (int-to-string col-start)) 502 (format "-k1.%d,1.%d"
503 (concat "-0." (int-to-string col-end))))) 503 (1+ col-start)
504 (1+ col-end)))))
504 (when sort-fold-case 505 (when sort-fold-case
505 (push "-f" sort-args)) 506 (push "-f" sort-args))
506 (apply #'call-process-region beg1 end1 "sort" t t nil sort-args)) 507 (apply #'call-process-region beg1 end1 "sort" t t nil sort-args))
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 3c70314703b..4b62eeb87a7 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.05
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,17 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.05
85;; - Changes to internal link system (thanks to David Wainberg for ideas).
86;; - in-file links: [[Search String]] instead of <file:::Search String>
87;; - automatic links to "radio targets".
88;; - CamelCase not longer active by default, configure org-activate-camels
89;; if you want to turn it back on.
90;; - After following a link, `C-c &' jumps back to it.
91;; - MH-E link support (thanks to Thomas Baumann).
92;; - Special table lines are no longer exported.
93;; - Bug fixes and minor improvements.
94;;
84;; Version 4.04 95;; Version 4.04
85;; - Cleanup tags display in agenda. 96;; - Cleanup tags display in agenda.
86;; - Bug fixes. 97;; - Bug fixes.
@@ -115,7 +126,7 @@
115 126
116;;; Customization variables 127;;; Customization variables
117 128
118(defvar org-version "4.04" 129(defvar org-version "4.05"
119 "The version number of the file org.el.") 130 "The version number of the file org.el.")
120(defun org-version () 131(defun org-version ()
121 (interactive) 132 (interactive)
@@ -775,7 +786,7 @@ as possible."
775(defcustom org-level-color-stars-only nil 786(defcustom org-level-color-stars-only nil
776 "Non-nil means fontify only the stars in each headline. 787 "Non-nil means fontify only the stars in each headline.
777When nil, the entire headline is fontified. 788When nil, the entire headline is fontified.
778Changing it requires a restart of Emacs to become effective." 789Changing it requires restart of Emacs to become effective."
779 :group 'org-structure 790 :group 'org-structure
780 :type 'boolean) 791 :type 'boolean)
781 792
@@ -930,6 +941,12 @@ Needs to be set before org.el is loaded."
930 :group 'org-link 941 :group 'org-link
931 :type 'boolean) 942 :type 'boolean)
932 943
944(defcustom org-mark-ring-length 4
945 "Number of different positions to be recorded in the ring
946Changing this requires a restart of Emacs to work correctly."
947 :group 'org-link
948 :type 'interger)
949
933(defcustom org-link-format "<%s>" 950(defcustom org-link-format "<%s>"
934 "Default format for linkes in the buffer. 951 "Default format for linkes in the buffer.
935This is a format string for printf, %s will be replaced by the link text. 952This is a format string for printf, %s will be replaced by the link text.
@@ -948,13 +965,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. 965When 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 966Note that in tables, a link never extends accross fields, so in a table
950it is always possible to put several links into a line. 967it is always possible to put several links into a line.
951Changing this variable requires a restart of Emacs to become effective." 968Changing this variable requires a restart of Emacs of become effective."
969 :group 'org-link
970 :type 'boolean)
971
972(defcustom org-radio-targets t
973 "Non-nil means activate text matching a link target.
974Radio targets are strings in triple angular brackets, like <<<My Target>>>.
975When this option is set, any occurrence of \"my target\" in normal text
976becomes a link."
977 :group 'org-link
978 :type 'boolean)
979
980(defcustom org-activate-camels nil
981 "Non-nil means, treat words in CamelCase as in-file links.
982Changing this requires restart of Emacs to become effective."
952 :group 'org-link 983 :group 'org-link
953 :type 'boolean) 984 :type 'boolean)
954 985
955(defcustom org-context-in-file-links t 986(defcustom org-context-in-file-links t
956 "Non-nil means, file links from `org-store-link' contain context. 987 "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 988A 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 989used to find the context when the link is activated by the command
959`org-open-at-point'. 990`org-open-at-point'.
960Using a prefix arg to the command \\[org-store-link] (`org-store-link') 991Using a prefix arg to the command \\[org-store-link] (`org-store-link')
@@ -962,6 +993,12 @@ negates this setting for the duration of the command."
962 :group 'org-link 993 :group 'org-link
963 :type 'boolean) 994 :type 'boolean)
964 995
996(defcustom org-file-link-context-use-camel-case nil
997 "Non-nil means, use CamelCase to store a search context in a file link.
998When nil, the search string simply consists of the words of the string."
999 :group 'org-link
1000 :type 'boolean)
1001
965(defcustom org-keep-stored-link-after-insertion nil 1002(defcustom org-keep-stored-link-after-insertion nil
966 "Non-nil means, keep link in list for entire session. 1003 "Non-nil means, keep link in list for entire session.
967 1004
@@ -1082,13 +1119,15 @@ For more examples, see the system specific constants
1082`org-file-apps-defaults-gnu'." 1119`org-file-apps-defaults-gnu'."
1083 :group 'org-link 1120 :group 'org-link
1084 :type '(repeat 1121 :type '(repeat
1085 (cons (string :tag "Extension") 1122 (cons (choice :value ""
1123 (string :tag "Extension")
1124 (const :tag "Default for unrecognized files" t)
1125 (const :tag "Links to a directory" directory))
1086 (choice :value "" 1126 (choice :value ""
1087 (const :tag "Visit with Emacs" 'emacs) 1127 (const :tag "Visit with Emacs" emacs)
1088 (const :tag "Use system default" 'default) 1128 (const :tag "Use system default" default)
1089 (string :tag "Command") 1129 (string :tag "Command")
1090 (sexp :tag "Lisp form"))))) 1130 (sexp :tag "Lisp form")))))
1091
1092 1131
1093(defgroup org-remember nil 1132(defgroup org-remember nil
1094 "Options concerning interaction with remember.el." 1133 "Options concerning interaction with remember.el."
@@ -1508,6 +1547,15 @@ This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
1508 :group 'org-export 1547 :group 'org-export
1509 :type 'boolean) 1548 :type 'boolean)
1510 1549
1550(defcustom org-export-table-remove-special-lines t
1551 "Remove special lines and marking characters in calculating tables.
1552This removes the special marking character column from tables that are set
1553up for spreadsheet calculations. It also removes the entire lines
1554marked with `!', `_', or `^'. The lines with `$' are kept, because
1555the values of constants may be useful to have."
1556 :group 'org-export
1557 :type 'boolean)
1558
1511(defcustom org-export-prefer-native-exporter-for-tables nil 1559(defcustom org-export-prefer-native-exporter-for-tables nil
1512 "Non-nil means, always export tables created with table.el natively. 1560 "Non-nil means, always export tables created with table.el natively.
1513Natively means, use the HTML code generator in table.el. 1561Natively means, use the HTML code generator in table.el.
@@ -1923,6 +1971,10 @@ When this is non-nil, the headline after the keyword is set to the
1923 (defvar gnus-group-name) 1971 (defvar gnus-group-name)
1924 (defvar gnus-article-current) 1972 (defvar gnus-article-current)
1925 (defvar w3m-current-url) 1973 (defvar w3m-current-url)
1974 (defvar mh-progs)
1975 (defvar mh-current-folder)
1976 (defvar mh-show-folder-buffer)
1977 (defvar mh-index-folder)
1926 (defvar org-selected-point) 1978 (defvar org-selected-point)
1927 (defvar calendar-mode-map) 1979 (defvar calendar-mode-map)
1928 (defvar remember-save-after-remembering) 1980 (defvar remember-save-after-remembering)
@@ -1981,17 +2033,11 @@ The following commands are available:
1981 'org-unfontify-region) 2033 'org-unfontify-region)
1982 ;; Activate before-change-function 2034 ;; Activate before-change-function
1983 (set (make-local-variable 'org-table-may-need-update) t) 2035 (set (make-local-variable 'org-table-may-need-update) t)
1984 (make-local-hook 'before-change-functions) ;; needed for XEmacs 2036 (org-add-hook 'before-change-functions 'org-before-change-function nil
1985 (add-hook 'before-change-functions 'org-before-change-function nil 2037 '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 2038 ;; Paragraphs and auto-filling
1994 (org-set-autofill-regexps) 2039 (org-set-autofill-regexps)
2040 (org-update-radio-target-regexp)
1995 ;; Settings for Calc embedded mode 2041 ;; Settings for Calc embedded mode
1996 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n") 2042 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n")
1997 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n") 2043 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n")
@@ -2053,9 +2099,9 @@ The following commands are available:
2053(defconst org-link-regexp 2099(defconst org-link-regexp
2054 (if org-allow-space-in-links 2100 (if org-allow-space-in-links
2055 (concat 2101 (concat
2056 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") 2102 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
2057 (concat 2103 (concat
2058 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") 2104 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
2059 ) 2105 )
2060 "Regular expression for matching links.") 2106 "Regular expression for matching links.")
2061(defconst org-link-maybe-angles-regexp 2107(defconst org-link-maybe-angles-regexp
@@ -2065,6 +2111,10 @@ The following commands are available:
2065 (concat "\000" org-link-regexp "\000") 2111 (concat "\000" org-link-regexp "\000")
2066 "Matches a link and optionally surrounding angle brackets.") 2112 "Matches a link and optionally surrounding angle brackets.")
2067 2113
2114(defconst org-bracket-link-regexp
2115 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
2116 "Matches a link in double brackets.")
2117
2068(defconst org-ts-lengths 2118(defconst org-ts-lengths
2069 (cons (length (format-time-string (car org-time-stamp-formats))) 2119 (cons (length (format-time-string (car org-time-stamp-formats)))
2070 (length (format-time-string (cdr org-time-stamp-formats)))) 2120 (length (format-time-string (cdr org-time-stamp-formats))))
@@ -2092,6 +2142,15 @@ The following commands are available:
2092 'keymap org-mouse-map)) 2142 'keymap org-mouse-map))
2093 t))) 2143 t)))
2094 2144
2145(defun org-activate-links2 (limit)
2146 "Run through the buffer and add overlays to links."
2147 (if (re-search-forward org-bracket-link-regexp limit t)
2148 (progn
2149 (add-text-properties (match-beginning 0) (match-end 0)
2150 (list 'mouse-face 'highlight
2151 'keymap org-mouse-map))
2152 t)))
2153
2095(defun org-activate-dates (limit) 2154(defun org-activate-dates (limit)
2096 "Run through the buffer and add overlays to dates." 2155 "Run through the buffer and add overlays to dates."
2097 (if (re-search-forward org-tsr-regexp limit t) 2156 (if (re-search-forward org-tsr-regexp limit t)
@@ -2101,19 +2160,75 @@ The following commands are available:
2101 'keymap org-mouse-map)) 2160 'keymap org-mouse-map))
2102 t))) 2161 t)))
2103 2162
2163(defvar org-target-link-regexp nil
2164 "Regular expression matching radio targets in plain text.")
2165(defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>"
2166 "Regular expression matching a link target.")
2167(defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>"
2168 "Regular expression matching a link target.")
2169
2170(defun org-activate-target-links (limit)
2171 "Run through the buffer and add overlays to target matches."
2172 (when org-radio-targets
2173 (let ((case-fold-search t))
2174 (if (re-search-forward org-target-link-regexp limit t)
2175 (progn
2176 (add-text-properties (match-beginning 0) (match-end 0)
2177 (list 'mouse-face 'highlight
2178 'keymap org-mouse-map
2179 'org-linked-text t))
2180 t)))))
2181
2182(defun org-update-radio-target-regexp ()
2183 "Find all radio targets in this file and update the regular expression."
2184 (interactive)
2185 (when org-radio-targets
2186 (setq org-target-link-regexp
2187 (org-make-target-link-regexp (org-all-targets 'radio)))
2188 (font-lock-mode -1)
2189 (font-lock-mode 1)))
2190
2191(defun org-all-targets (&optional radio)
2192 "Return a list of all targets in this file.
2193With optional argument RADIO, only find radio targets."
2194 (let ((re (if radio org-radio-target-regexp org-target-regexp))
2195 rtn)
2196 (save-excursion
2197 (goto-char (point-min))
2198 (while (re-search-forward re nil t)
2199 (add-to-list 'rtn (downcase (match-string-no-properties 1))))
2200 rtn)))
2201
2202(defun org-make-target-link-regexp (targets)
2203 "Make regular expression matching all strings in TARGETS.
2204The regular expression finds the targets also if there is a line break
2205between words."
2206 (concat
2207 "\\<\\("
2208 (mapconcat
2209 (lambda (x)
2210 (while (string-match " +" x)
2211 (setq x (replace-match "\\s-+" t t x)))
2212 x)
2213 targets
2214 "\\|")
2215 "\\)\\>"))
2216
2104(defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>" 2217(defvar org-camel-regexp "\\*?\\<[A-Z]+[a-z]+[A-Z][a-zA-Z]*\\>"
2105 "Matches CamelCase words, possibly with a star before it.") 2218 "Matches CamelCase words, possibly with a star before it.")
2219
2106(defun org-activate-camels (limit) 2220(defun org-activate-camels (limit)
2107 "Run through the buffer and add overlays to dates." 2221 "Run through the buffer and add overlays to dates."
2108 (if (re-search-forward org-camel-regexp limit t) 2222 (if org-activate-camels
2109 (progn 2223 (if (re-search-forward org-camel-regexp limit t)
2110 (add-text-properties (match-beginning 0) (match-end 0) 2224 (progn
2111 (list 'mouse-face 'highlight 2225 (add-text-properties (match-beginning 0) (match-end 0)
2112 'keymap org-mouse-map)) 2226 (list 'mouse-face 'highlight
2113 t))) 2227 'keymap org-mouse-map))
2228 t))))
2114 2229
2115(defun org-activate-tags (limit) 2230(defun org-activate-tags (limit)
2116 (if (re-search-forward "[ \t]\\(:[A-Za-z_:]+:\\)[ \r\n]" limit t) 2231 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
2117 (progn 2232 (progn
2118 (add-text-properties (match-beginning 1) (match-end 1) 2233 (add-text-properties (match-beginning 1) (match-end 1)
2119 (list 'mouse-face 'highlight 2234 (list 'mouse-face 'highlight
@@ -2138,6 +2253,8 @@ The following commands are available:
2138 (let ((org-font-lock-extra-keywords 2253 (let ((org-font-lock-extra-keywords
2139 (list 2254 (list
2140 '(org-activate-links (0 'org-link t)) 2255 '(org-activate-links (0 'org-link t))
2256 '(org-activate-links2 (0 'org-link t))
2257 '(org-activate-target-links (0 'org-link t))
2141 '(org-activate-dates (0 'org-link t)) 2258 '(org-activate-dates (0 'org-link t))
2142 '(org-activate-camels (0 'org-link t)) 2259 '(org-activate-camels (0 'org-link t))
2143 '(org-activate-tags (1 'org-link t)) 2260 '(org-activate-tags (1 'org-link t))
@@ -2199,7 +2316,8 @@ The following commands are available:
2199 (inhibit-read-only t) (inhibit-point-motion-hooks t) 2316 (inhibit-read-only t) (inhibit-point-motion-hooks t)
2200 (inhibit-modification-hooks t) 2317 (inhibit-modification-hooks t)
2201 deactivate-mark buffer-file-name buffer-file-truename) 2318 deactivate-mark buffer-file-name buffer-file-truename)
2202 (remove-text-properties beg end '(mouse-face nil keymap nil)))) 2319 (remove-text-properties beg end
2320 '(mouse-face nil keymap nil org-linked-text nil))))
2203 2321
2204;;; Visibility cycling 2322;;; Visibility cycling
2205 2323
@@ -2433,8 +2551,10 @@ to the new location, making it and the headline hierarchy above it visible."
2433 (org-get-location (current-buffer) org-goto-help))) 2551 (org-get-location (current-buffer) org-goto-help)))
2434 (if selected-point 2552 (if selected-point
2435 (progn 2553 (progn
2554 (org-mark-ring-push org-goto-start-pos)
2436 (goto-char selected-point) 2555 (goto-char selected-point)
2437 (if (org-invisible-p) (org-show-hierarchy-above))) 2556 (if (or (org-invisible-p) (org-invisible-p2))
2557 (org-show-hierarchy-above)))
2438 (error "Quit")))) 2558 (error "Quit"))))
2439 2559
2440(defun org-get-location (buf help) 2560(defun org-get-location (buf help)
@@ -3213,7 +3333,7 @@ At all other locations, this simply calls `ispell-complete-word'."
3213 (let* ((end (point)) 3333 (let* ((end (point))
3214 (beg1 (save-excursion 3334 (beg1 (save-excursion
3215 (if (equal (char-before (point)) ?\ ) (backward-char 1)) 3335 (if (equal (char-before (point)) ?\ ) (backward-char 1))
3216 (skip-chars-backward "a-zA-Z_") 3336 (skip-chars-backward "a-zA-Z_@0-9")
3217 (point))) 3337 (point)))
3218 (beg (save-excursion 3338 (beg (save-excursion
3219 (if (equal (char-before (point)) ?\ ) (backward-char 1)) 3339 (if (equal (char-before (point)) ?\ ) (backward-char 1))
@@ -3247,7 +3367,11 @@ At all other locations, this simply calls `ispell-complete-word'."
3247 (save-excursion 3367 (save-excursion
3248 (goto-char (point-min)) 3368 (goto-char (point-min))
3249 (while (re-search-forward org-todo-line-regexp nil t) 3369 (while (re-search-forward org-todo-line-regexp nil t)
3250 (push (list (org-make-org-heading-camel (match-string 3))) 3370 (push (list
3371 (if org-file-link-context-use-camel-case
3372 (org-make-org-heading-camel (match-string 3) t)
3373 (org-make-org-heading-search-string
3374 (match-string 3) t)))
3251 tbl))) 3375 tbl)))
3252 tbl) 3376 tbl)
3253 (tag (setq type :tag beg beg1) 3377 (tag (setq type :tag beg beg1)
@@ -3475,9 +3599,8 @@ that the match should indeed be shown."
3475 (setq cnt (1+ cnt)) 3599 (setq cnt (1+ cnt))
3476 (org-highlight-new-match (match-beginning 0) (match-end 0)) 3600 (org-highlight-new-match (match-beginning 0) (match-end 0))
3477 (org-show-hierarchy-above)))) 3601 (org-show-hierarchy-above))))
3478 (make-local-hook 'before-change-functions) ; needed for XEmacs 3602 (org-add-hook 'before-change-functions 'org-remove-occur-highlights
3479 (add-hook 'before-change-functions 'org-remove-occur-highlights 3603 nil 'local)
3480 nil 'local)
3481 (run-hooks 'org-occur-hook) 3604 (run-hooks 'org-occur-hook)
3482 (if (interactive-p) 3605 (if (interactive-p)
3483 (message "%d match(es) for regexp %s" cnt regexp)) 3606 (message "%d match(es) for regexp %s" cnt regexp))
@@ -3488,7 +3611,8 @@ that the match should indeed be shown."
3488 (catch 'exit 3611 (catch 'exit
3489 (if (org-on-heading-p t) 3612 (if (org-on-heading-p t)
3490 (org-flag-heading nil) ; only show the heading 3613 (org-flag-heading nil) ; only show the heading
3491 (and (org-invisible-p) (org-show-hidden-entry))) ; show entire entry 3614 (and (or (org-invisible-p) (org-invisible-p2))
3615 (org-show-hidden-entry))) ; show entire entry
3492 (save-excursion 3616 (save-excursion
3493 (and org-show-following-heading 3617 (and org-show-following-heading
3494 (outline-next-heading) 3618 (outline-next-heading)
@@ -3765,7 +3889,8 @@ used to insert the time stamp into the buffer to include the time."
3765 (progn 3889 (progn
3766 (use-local-map map) 3890 (use-local-map map)
3767 (setq ans (read-string prompt "" nil nil)) 3891 (setq ans (read-string prompt "" nil nil))
3768 (setq ans (or ans1 ans2 ans))) 3892 (if (not (string-match "\\S-" ans)) (setq ans nil))
3893 (setq ans (or ans1 ans ans2)))
3769 (use-local-map old-map))))) 3894 (use-local-map old-map)))))
3770 ;; Naked prompt only 3895 ;; Naked prompt only
3771 (setq ans (read-string prompt "" nil timestr))) 3896 (setq ans (read-string prompt "" nil timestr)))
@@ -4133,10 +4258,8 @@ The following commands are available:
4133 (use-local-map org-agenda-mode-map) 4258 (use-local-map org-agenda-mode-map)
4134 (easy-menu-add org-agenda-menu) 4259 (easy-menu-add org-agenda-menu)
4135 (if org-startup-truncated (setq truncate-lines t)) 4260 (if org-startup-truncated (setq truncate-lines t))
4136 (make-local-hook 'post-command-hook) ; Needed for XEmacs 4261 (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) 4262 (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 4263 (unless org-agenda-keep-modes
4141 (setq org-agenda-follow-mode nil 4264 (setq org-agenda-follow-mode nil
4142 org-agenda-show-log nil)) 4265 org-agenda-show-log nil))
@@ -5285,27 +5408,6 @@ the documentation of `org-diary'."
5285 (throw 'exit t))) 5408 (throw 'exit t)))
5286 nil))) 5409 nil)))
5287 5410
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 () 5411(defun org-agenda-get-todos ()
5310 "Return the TODO information for agenda display." 5412 "Return the TODO information for agenda display."
5311 (let* ((props (list 'face nil 5413 (let* ((props (list 'face nil
@@ -5726,7 +5828,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) 5828 (when (and (or (eq org-agenda-remove-tags-when-in-prefix t)
5727 (and org-agenda-remove-tags-when-in-prefix 5829 (and org-agenda-remove-tags-when-in-prefix
5728 org-prefix-has-tag)) 5830 org-prefix-has-tag))
5729 (string-match ":[a-zA-Z_:]+:[ \t]*$" txt)) 5831 (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" txt))
5730 (setq txt (replace-match "" t t txt))) 5832 (setq txt (replace-match "" t t txt)))
5731 5833
5732 ;; Create the final string 5834 ;; Create the final string
@@ -6076,6 +6178,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) 6178 (org-agenda-change-all-lines newhead hdmarker)
6077 (beginning-of-line 1))) 6179 (beginning-of-line 1)))
6078 6180
6181(defun org-get-tags-at (&optional pos)
6182 "Get a list of all headline targs applicable at POS.
6183POS defaults to point. If tags are inherited, the list contains
6184the targets in the same sequence as the headlines appear, i.e.
6185the tags of the current headline come last."
6186 (interactive)
6187 (let (tags)
6188 (save-excursion
6189 (goto-char (or pos (point)))
6190 (save-match-data
6191 (org-back-to-heading t)
6192 (condition-case nil
6193 (while t
6194 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
6195 (setq tags (append (org-split-string (match-string 1) ":") tags)))
6196 (or org-use-tag-inheritance (error ""))
6197 (org-up-heading-all 1))
6198 (error nil))))
6199 (message "%s" tags)
6200 tags))
6201
6079(defun org-agenda-set-tags () 6202(defun org-agenda-set-tags ()
6080 "Set tags for the current headline." 6203 "Set tags for the current headline."
6081 (interactive) 6204 (interactive)
@@ -6298,7 +6421,7 @@ are included in the output."
6298 (mapconcat 'regexp-quote 6421 (mapconcat 'regexp-quote
6299 (nreverse (cdr (reverse org-todo-keywords))) 6422 (nreverse (cdr (reverse org-todo-keywords)))
6300 "\\|") 6423 "\\|")
6301 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_:]+:\\)?[ \t]*[\n\r]")) 6424 "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*[\n\r]"))
6302 (props (list 'face nil 6425 (props (list 'face nil
6303 'done-face 'org-done 6426 'done-face 'org-done
6304 'undone-face nil 6427 'undone-face nil
@@ -6386,7 +6509,7 @@ MATCH can contain positive and negative selection of tags, like
6386 (let ((match0 match) minus tag mm matcher orterms term orlist) 6509 (let ((match0 match) minus tag mm matcher orterms term orlist)
6387 (setq orterms (org-split-string match "|")) 6510 (setq orterms (org-split-string match "|"))
6388 (while (setq term (pop orterms)) 6511 (while (setq term (pop orterms))
6389 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_]+\\)" term) 6512 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_@0-9]+\\)" term)
6390 (setq minus (and (match-end 1) 6513 (setq minus (and (match-end 1)
6391 (equal (match-string 1 term) "-")) 6514 (equal (match-string 1 term) "-"))
6392 tag (match-string 2 term) 6515 tag (match-string 2 term)
@@ -6481,7 +6604,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6481 (re (concat "^" outline-regexp)) 6604 (re (concat "^" outline-regexp))
6482 (col (current-column)) 6605 (col (current-column))
6483 (current (org-get-tags)) 6606 (current (org-get-tags))
6484 tags hd empty) 6607 tags hd empty invis)
6485 (if arg 6608 (if arg
6486 (save-excursion 6609 (save-excursion
6487 (goto-char (point-min)) 6610 (goto-char (point-min))
@@ -6505,19 +6628,23 @@ With prefix ARG, realign all tags in headings in the current buffer."
6505 (if (equal current "") 6628 (if (equal current "")
6506 (progn 6629 (progn
6507 (end-of-line 1) 6630 (end-of-line 1)
6508 (or empty (insert " "))) 6631 (or empty (insert-before-markers " ")))
6509 (beginning-of-line 1) 6632 (beginning-of-line 1)
6633 (setq invis (org-invisible-p))
6510 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*")) 6634 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
6511 (setq hd (match-string 1)) 6635 (setq hd (match-string 1))
6512 (delete-region (match-beginning 0) (match-end 0)) 6636 (delete-region (match-beginning 0) (match-end 0))
6513 (insert (org-trim hd) (if empty "" " "))) 6637 (insert-before-markers (org-trim hd) (if empty "" " ")))
6638 ;; FIXME: What happens when adding a new tag??? Seems OK!!!
6514 (unless (equal tags "") 6639 (unless (equal tags "")
6515 (move-to-column (max (current-column) 6640 (move-to-column (max (current-column)
6516 (if (> org-tags-column 0) 6641 (if (> org-tags-column 0)
6517 org-tags-column 6642 org-tags-column
6518 (- (- org-tags-column) (length tags)))) 6643 (- (- org-tags-column) (length tags))))
6519 t) 6644 t)
6520 (insert tags)) 6645 (insert-before-markers tags)
6646 (if (and (not invis) (org-invisible-p))
6647 (outline-flag-region (point-at-bol) (point) nil)))
6521 (move-to-column col)))) 6648 (move-to-column col))))
6522 6649
6523(defun org-tags-completion-function (string predicate &optional flag) 6650(defun org-tags-completion-function (string predicate &optional flag)
@@ -6551,7 +6678,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6551 (error "Not on a heading")) 6678 (error "Not on a heading"))
6552 (save-excursion 6679 (save-excursion
6553 (beginning-of-line 1) 6680 (beginning-of-line 1)
6554 (if (looking-at ".*[ \t]\\(:[A-Za-z_:]+:\\)[ \t]*\\(\r\\|$\\)") 6681 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
6555 (match-string 1) 6682 (match-string 1)
6556 ""))) 6683 "")))
6557 6684
@@ -6560,7 +6687,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6560 (let (tags) 6687 (let (tags)
6561 (save-excursion 6688 (save-excursion
6562 (goto-char (point-min)) 6689 (goto-char (point-min))
6563 (while (re-search-forward "[ \t]:\\([A-Za-z_:]+\\):[ \t\r\n]" nil t) 6690 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
6564 (mapc (lambda (x) (add-to-list 'tags x)) 6691 (mapc (lambda (x) (add-to-list 'tags x))
6565 (org-split-string (match-string 1) ":")))) 6692 (org-split-string (match-string 1) ":"))))
6566 (mapcar 'list tags))) 6693 (mapcar 'list tags)))
@@ -6591,9 +6718,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 6718 (org-agenda-list nil (time-to-days (org-time-string-to-time
6592 (substring (match-string 1) 0 10))) 6719 (substring (match-string 1) 0 10)))
6593 1) 6720 1)
6594 (let (type path line search (pos (point))) 6721 (let (type path link line search (pos (point)))
6595 (catch 'match 6722 (catch 'match
6596 (save-excursion 6723 (save-excursion
6724 (skip-chars-forward "^]\n\r")
6725 (when (and (re-search-backward "\\[\\[" nil t)
6726 (looking-at org-bracket-link-regexp)
6727 (<= (match-beginning 0) pos)
6728 (>= (match-end 0) pos))
6729 (setq link (match-string 1))
6730 (while (string-match " *\n *" link)
6731 (setq link (replace-match " " t t link)))
6732 (if (string-match org-link-regexp link)
6733 (setq type (match-string 1)
6734 path (match-string 2))
6735 (setq type "thisfile"
6736 path link))
6737 (throw 'match t)))
6738
6739 (when (get-text-property (point) 'org-linked-text)
6740 (setq type "thisfile"
6741 pos (if (get-text-property (1+ (point)) 'org-linked-text)
6742 (1+ (point)) (point))
6743 path (buffer-substring
6744 (previous-single-property-change pos 'org-linked-text)
6745 (next-single-property-change pos 'org-linked-text)))
6746 (throw 'match t))
6747
6748 (save-excursion
6597 (skip-chars-backward 6749 (skip-chars-backward
6598 (concat (if org-allow-space-in-links "^" "^ ") 6750 (concat (if org-allow-space-in-links "^" "^ ")
6599 org-non-link-chars)) 6751 org-non-link-chars))
@@ -6606,7 +6758,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6606 (throw 'match t))) 6758 (throw 'match t)))
6607 (save-excursion 6759 (save-excursion
6608 (skip-chars-backward "^ \t\n\r") 6760 (skip-chars-backward "^ \t\n\r")
6609 (when (looking-at "\\(:[A-Za-z_:]+\\):[ \t\r\n]") 6761 (when (looking-at "\\(:[A-Za-z_@0-9:]+\\):[ \t\r\n]")
6610 (setq type "tags" 6762 (setq type "tags"
6611 path (match-string 1)) 6763 path (match-string 1))
6612 (while (string-match ":" path) 6764 (while (string-match ":" path)
@@ -6614,7 +6766,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6614 (throw 'match t))) 6766 (throw 'match t)))
6615 (save-excursion 6767 (save-excursion
6616 (skip-chars-backward "a-zA-Z_") 6768 (skip-chars-backward "a-zA-Z_")
6617 (when (looking-at org-camel-regexp) 6769 (when (and org-activate-camels
6770 (looking-at org-camel-regexp))
6618 (setq type "camel" path (match-string 0)) 6771 (setq type "camel" path (match-string 0))
6619 (if (equal (char-before) ?*) 6772 (if (equal (char-before) ?*)
6620 (setq path (concat "*" path)))) 6773 (setq path (concat "*" path))))
@@ -6639,7 +6792,9 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6639 6792
6640 ((string= type "tags") 6793 ((string= type "tags")
6641 (org-tags-view in-emacs path)) 6794 (org-tags-view in-emacs path))
6642 ((string= type "camel") 6795 ((or (string= type "camel")
6796 (string= type "thisfile"))
6797 (org-mark-ring-push)
6643 (org-link-search 6798 (org-link-search
6644 path 6799 path
6645 (cond ((equal in-emacs '(4)) 'occur) 6800 (cond ((equal in-emacs '(4)) 'occur)
@@ -6686,6 +6841,14 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6686 article (match-string 3 path)) 6841 article (match-string 3 path))
6687 (org-follow-wl-link folder article))) 6842 (org-follow-wl-link folder article)))
6688 6843
6844 ((string= type "mhe")
6845 (let (folder article)
6846 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
6847 (error "Error in MHE link"))
6848 (setq folder (match-string 1 path)
6849 article (match-string 3 path))
6850 (org-follow-mhe-link folder article)))
6851
6689 ((string= type "rmail") 6852 ((string= type "rmail")
6690 (let (folder article) 6853 (let (folder article)
6691 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path)) 6854 (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
@@ -6717,11 +6880,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 6880If the current buffer is in `dired-mode', grep will be used to search
6718in all files." 6881in all files."
6719 (let ((case-fold-search t) 6882 (let ((case-fold-search t)
6720 (s0 s) 6883 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
6721 (pos (point)) 6884 (pos (point))
6722 (pre "") (post "") 6885 (pre "") (post "")
6723 words re0 re1 re2 re3 re4 re5 reall) 6886 words re0 re1 re2 re3 re4 re5 reall camel)
6724 (cond ((string-match "^/\\(.*\\)/$" s) 6887 (cond ((save-excursion
6888 (goto-char (point-min))
6889 (and
6890 (re-search-forward
6891 (concat "<<" (regexp-quote s0) ">>") nil t)
6892 (setq pos (match-beginning 0))))
6893 ;; There is an exact target for this
6894 (goto-char pos))
6895 ((string-match "^/\\(.*\\)/$" s)
6725 ;; A regular expression 6896 ;; A regular expression
6726 (cond 6897 (cond
6727 ((eq major-mode 'org-mode) 6898 ((eq major-mode 'org-mode)
@@ -6729,17 +6900,22 @@ in all files."
6729 ;;((eq major-mode 'dired-mode) 6900 ;;((eq major-mode 'dired-mode)
6730 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) 6901 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
6731 (t (org-do-occur (match-string 1 s))))) 6902 (t (org-do-occur (match-string 1 s)))))
6732 ((string-match (concat "^" org-camel-regexp) s) 6903 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s))
6733 ;; A camel 6904 t)
6734 (if (equal (string-to-char s) ?*) 6905 ;; A camel or a normal search string
6735 (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*" 6906 (when (equal (string-to-char s) ?*)
6736 post "[ \t]*$" 6907 ;; Anchor on headlines, post may include tags.
6737 s (substring s 1))) 6908 (setq pre "^\\*+[ \t]*\\(\\sw+\\)?[ \t]*"
6909 post "[ \t]*\\([ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$"
6910 s (substring s 1)))
6738 (remove-text-properties 6911 (remove-text-properties
6739 0 (length s) 6912 0 (length s)
6740 '(face nil mouse-face nil keymap nil fontified nil) s) 6913 '(face nil mouse-face nil keymap nil fontified nil) s)
6741 ;; Make a series of regular expressions to find a match 6914 ;; Make a series of regular expressions to find a match
6742 (setq words (org-camel-to-words s) 6915 (setq words
6916 (if camel
6917 (org-camel-to-words s)
6918 (org-split-string s "[ \n\r\t]+"))
6743 re0 (concat "<<" (regexp-quote s0) ">>") 6919 re0 (concat "<<" (regexp-quote s0) ">>")
6744 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>") 6920 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>")
6745 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>") 6921 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>")
@@ -6770,7 +6946,8 @@ in all files."
6770 (goto-char (point-min)) 6946 (goto-char (point-min))
6771 (if (search-forward s nil t) 6947 (if (search-forward s nil t)
6772 (goto-char (match-beginning 0)) 6948 (goto-char (match-beginning 0))
6773 (error "No match")))))) 6949 (error "No match"))))
6950 (and (eq major-mode 'org-mode) (org-show-hierarchy-above))))
6774 6951
6775(defun org-do-occur (regexp &optional cleanup) 6952(defun org-do-occur (regexp &optional cleanup)
6776 "Call the Emacs command `occur'. 6953 "Call the Emacs command `occur'.
@@ -6791,6 +6968,47 @@ to read."
6791 (goto-char (point-min)) 6968 (goto-char (point-min))
6792 (select-window cwin)))) 6969 (select-window cwin))))
6793 6970
6971(defvar org-mark-ring nil
6972 "Mark ring for positions before jumps in Org-mode.")
6973(defvar org-mark-ring-last-goto nil
6974 "Last position in the mark ring used to go back.")
6975;; Fill and close the ring
6976(setq org-mark-ring nil org-mark-ring-last-goto nil) ;; in case file is reloaded
6977(loop for i from 1 to org-mark-ring-length do
6978 (push (make-marker) org-mark-ring))
6979(setcdr (nthcdr (1- org-mark-ring-length) org-mark-ring)
6980 org-mark-ring)
6981
6982(defun org-mark-ring-push (&optional pos buffer)
6983 "Put the current position or POS into the mark ring and rotate it."
6984 (interactive)
6985 (setq pos (or pos (point)))
6986 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring))
6987 (move-marker (car org-mark-ring)
6988 (or pos (point))
6989 (or buffer (current-buffer)))
6990 (message
6991 (substitute-command-keys
6992 "Position saved to mark ring, go back with \\[org-mark-ring-goto].")))
6993
6994(defun org-mark-ring-goto (&optional n)
6995 "Jump to the previous position in the mark ring.
6996With prefix arg N, jump back that many stored positions. When
6997called several times in succession, walk through the entire ring.
6998Org-mode commands jumping to a different position in the current file,
6999or to another Org-mode file, automatically push the old position
7000onto the ring."
7001 (interactive "p")
7002 (let (p m)
7003 (if (eq last-command this-command)
7004 (setq p (nthcdr n (or org-mark-ring-last-goto org-mark-ring)))
7005 (setq p org-mark-ring))
7006 (setq org-mark-ring-last-goto p)
7007 (setq m (car p))
7008 (switch-to-buffer (marker-buffer m))
7009 (goto-char m)
7010 (if (or (org-invisible-p) (org-invisible-p2)) (org-show-hierarchy-above))))
7011
6794(defun org-camel-to-words (s) 7012(defun org-camel-to-words (s)
6795 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")." 7013 "Split \"CamelCaseWords\" to (\"Camel\" \"Case\" \"Words\")."
6796 (let ((case-fold-search nil) 7014 (let ((case-fold-search nil)
@@ -6800,10 +7018,20 @@ to read."
6800 (setq s (substring s (1+ (match-beginning 0))))) 7018 (setq s (substring s (1+ (match-beginning 0)))))
6801 (nreverse (cons s words)))) 7019 (nreverse (cons s words))))
6802 7020
7021(defun org-remove-angle-brackets (s)
7022 (if (equal (substring s 0 1) "<") (setq s (substring s 1)))
7023 (if (equal (substring s -1) ">") (setq s (substring s 0 -1)))
7024 s)
7025(defun org-add-angle-brackets (s)
7026 (if (equal (substring s 0 1) "<") nil (setq s (concat "<" s)))
7027 (if (equal (substring s -1) ">") nil (setq s (concat s ">")))
7028 s)
7029
6803(defun org-follow-bbdb-link (name) 7030(defun org-follow-bbdb-link (name)
6804 "Follow a BBDB link to NAME." 7031 "Follow a BBDB link to NAME."
6805 (require 'bbdb) 7032 (require 'bbdb)
6806 (let ((inhibit-redisplay t)) 7033 (let ((inhibit-redisplay t)
7034 (bbdb-electric-p nil))
6807 (catch 'exit 7035 (catch 'exit
6808 ;; Exact match on name 7036 ;; Exact match on name
6809 (bbdb-name (concat "\\`" name "\\'") nil) 7037 (bbdb-name (concat "\\`" name "\\'") nil)
@@ -6839,6 +7067,7 @@ to read."
6839(defun org-follow-vm-link (&optional folder article readonly) 7067(defun org-follow-vm-link (&optional folder article readonly)
6840 "Follow a VM link to FOLDER and ARTICLE." 7068 "Follow a VM link to FOLDER and ARTICLE."
6841 (require 'vm) 7069 (require 'vm)
7070 (setq article (org-add-angle-brackets article))
6842 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder) 7071 (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
6843 ;; ange-ftp or efs or tramp access 7072 ;; ange-ftp or efs or tramp access
6844 (let ((user (or (match-string 1 folder) (user-login-name))) 7073 (let ((user (or (match-string 1 folder) (user-login-name)))
@@ -6872,12 +7101,14 @@ to read."
6872 7101
6873(defun org-follow-wl-link (folder article) 7102(defun org-follow-wl-link (folder article)
6874 "Follow a Wanderlust link to FOLDER and ARTICLE." 7103 "Follow a Wanderlust link to FOLDER and ARTICLE."
7104 (setq article (org-add-angle-brackets article))
6875 (wl-summary-goto-folder-subr folder 'no-sync t nil t) 7105 (wl-summary-goto-folder-subr folder 'no-sync t nil t)
6876 (if article (wl-summary-jump-to-msg-by-message-id article)) 7106 (if article (wl-summary-jump-to-msg-by-message-id article ">"))
6877 (wl-summary-redisplay)) 7107 (wl-summary-redisplay))
6878 7108
6879(defun org-follow-rmail-link (folder article) 7109(defun org-follow-rmail-link (folder article)
6880 "Follow an RMAIL link to FOLDER and ARTICLE." 7110 "Follow an RMAIL link to FOLDER and ARTICLE."
7111 (setq article (org-add-angle-brackets article))
6881 (let (message-number) 7112 (let (message-number)
6882 (save-excursion 7113 (save-excursion
6883 (save-window-excursion 7114 (save-window-excursion
@@ -6898,6 +7129,107 @@ to read."
6898 message-number) 7129 message-number)
6899 (error "Message not found")))) 7130 (error "Message not found"))))
6900 7131
7132;; mh-e integration based on planner-mode
7133(defun org-mhe-get-message-real-folder ()
7134 "Return the name of the current message real folder, so if you use
7135 sequences, it will now work."
7136 (save-excursion
7137 (let* ((folder
7138 (if (equal major-mode 'mh-folder-mode)
7139 mh-current-folder
7140 ;; Refer to the show buffer
7141 mh-show-folder-buffer))
7142 (end-index
7143 (if (boundp 'mh-index-folder)
7144 (min (length mh-index-folder) (length folder))))
7145 )
7146 ;; a simple test on mh-index-data does not work, because
7147 ;; mh-index-data is always nil in a show buffer.
7148 (if (and (boundp 'mh-index-folder)
7149 (string= mh-index-folder (substring folder 0 end-index)))
7150 (if (equal major-mode 'mh-show-mode)
7151 (save-window-excursion
7152 (when (buffer-live-p (get-buffer folder))
7153 (progn
7154 (pop-to-buffer folder)
7155 (org-mhe-get-message-folder-from-index)
7156 )
7157 ))
7158 (org-mhe-get-message-folder-from-index)
7159 )
7160 folder
7161 )
7162 )))
7163
7164(defun org-mhe-get-message-folder-from-index ()
7165 "Returns the name of the message folder in a index folder
7166 buffer."
7167 (save-excursion
7168 (mh-index-previous-folder)
7169 (if (not (re-search-forward "^\\(+.*\\)$" nil t))
7170 (message "Problem getting folder from index.")
7171 (message (match-string 1)))))
7172
7173(defun org-mhe-get-message-folder ()
7174 "Return the name of the current message folder. Be careful if you
7175 use sequences."
7176 (save-excursion
7177 (if (equal major-mode 'mh-folder-mode)
7178 mh-current-folder
7179 ;; Refer to the show buffer
7180 mh-show-folder-buffer)))
7181
7182(defun org-mhe-get-message-num ()
7183 "Return the number of the current message. Be careful if you
7184 use sequences."
7185 (save-excursion
7186 (if (equal major-mode 'mh-folder-mode)
7187 (mh-get-msg-num nil)
7188 ;; Refer to the show buffer
7189 (mh-show-buffer-message-number))))
7190
7191(defun org-mhe-get-header (header)
7192 "Return a header of the message in folder mode. This will create a
7193 show buffer for the corresponding message. If you have a more clever
7194 idea..."
7195 (let* ((folder (org-mhe-get-message-folder))
7196 (num (org-mhe-get-message-num))
7197 (buffer (get-buffer-create (concat "show-" folder)))
7198 (header-field))
7199 (with-current-buffer buffer
7200 (mh-display-msg num folder)
7201 (if (equal major-mode 'mh-folder-mode)
7202 (mh-header-display)
7203 (mh-show-header-display))
7204 (set-buffer buffer)
7205 (setq header-field (mh-get-header-field header))
7206 (if (equal major-mode 'mh-folder-mode)
7207 (mh-show)
7208 (mh-show-show))
7209 header-field)))
7210
7211(defun org-follow-mhe-link (folder article)
7212 "Follow an MHE link to FOLDER and ARTICLE."
7213 (setq article (org-add-angle-brackets article))
7214;; (require 'mh-e)
7215 (mh-rmail) ;; mh-e is standard with emacs 22
7216 (let* ((show-buf (concat "show-" folder)))
7217 (get-buffer-create show-buf)
7218 (mh-display-msg
7219 (string-to-number
7220 (car (split-string
7221 (with-temp-buffer
7222 (call-process
7223 (expand-file-name "pick" mh-progs)
7224 nil t nil
7225 folder
7226 "--message-id"
7227 article)
7228 (buffer-string))
7229 "\n")))
7230 folder)
7231 (pop-to-buffer show-buf)))
7232
6901(defun org-open-file (path &optional in-emacs line search) 7233(defun org-open-file (path &optional in-emacs line search)
6902 "Open the file at PATH. 7234 "Open the file at PATH.
6903First, this expands any special file name abbreviations. Then the 7235First, this expands any special file name abbreviations. Then the
@@ -6913,7 +7245,11 @@ If the file does not exist, an error is thrown."
6913 (let* ((file (if (equal path "") 7245 (let* ((file (if (equal path "")
6914 (buffer-file-name) 7246 (buffer-file-name)
6915 (convert-standard-filename (org-expand-file-name path)))) 7247 (convert-standard-filename (org-expand-file-name path))))
7248 (dirp (file-directory-p file))
6916 (dfile (downcase file)) 7249 (dfile (downcase file))
7250 (old-buffer (current-buffer))
7251 (old-pos (point))
7252 (old-mode major-mode)
6917 ext cmd apps) 7253 ext cmd apps)
6918 (if (and (not (file-exists-p file)) 7254 (if (and (not (file-exists-p file))
6919 (not org-open-non-existing-files)) 7255 (not org-open-non-existing-files))
@@ -6925,7 +7261,8 @@ If the file does not exist, an error is thrown."
6925 (setq apps (append org-file-apps (org-default-apps))) 7261 (setq apps (append org-file-apps (org-default-apps)))
6926 (if in-emacs 7262 (if in-emacs
6927 (setq cmd 'emacs) 7263 (setq cmd 'emacs)
6928 (setq cmd (or (cdr (assoc ext apps)) 7264 (setq cmd (or (and dirp (cdr (assoc 'directory apps)))
7265 (cdr (assoc ext apps))
6929 (cdr (assoc t apps))))) 7266 (cdr (assoc t apps)))))
6930 (when (eq cmd 'mailcap) 7267 (when (eq cmd 'mailcap)
6931 (require 'mailcap) 7268 (require 'mailcap)
@@ -6948,7 +7285,11 @@ If the file does not exist, an error is thrown."
6948 (if search (org-link-search search)))) 7285 (if search (org-link-search search))))
6949 ((consp cmd) 7286 ((consp cmd)
6950 (eval cmd)) 7287 (eval cmd))
6951 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))))) 7288 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
7289 (and (eq major-mode 'org-mode) (eq old-mode 'org-mode)
7290 (or (not (equal old-buffer (current-buffer)))
7291 (not (equal old-pos (point))))
7292 (org-mark-ring-push old-pos old-buffer))))
6952 7293
6953(defun org-default-apps () 7294(defun org-default-apps ()
6954 "Return the default applications for this operating system." 7295 "Return the default applications for this operating system."
@@ -6979,7 +7320,7 @@ For some link types, a prefix arg is interpreted:
6979For links to usenet articles, arg negates `org-usenet-links-prefer-google'. 7320For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
6980For file links, arg negates `org-context-in-file-links'." 7321For file links, arg negates `org-context-in-file-links'."
6981 (interactive "P") 7322 (interactive "P")
6982 (let (link cpltxt) 7323 (let (link cpltxt txt (pos (point)))
6983 (cond 7324 (cond
6984 7325
6985 ((eq major-mode 'bbdb-mode) 7326 ((eq major-mode 'bbdb-mode)
@@ -7009,6 +7350,7 @@ For file links, arg negates `org-context-in-file-links'."
7009 (subject (vm-su-subject message)) 7350 (subject (vm-su-subject message))
7010 (author (vm-su-full-name message)) 7351 (author (vm-su-full-name message))
7011 (message-id (vm-su-message-id message))) 7352 (message-id (vm-su-message-id message)))
7353 (setq message-id (org-remove-angle-brackets message-id))
7012 (setq folder (abbreviate-file-name folder)) 7354 (setq folder (abbreviate-file-name folder))
7013 (if (string-match (concat "^" (regexp-quote vm-folder-directory)) 7355 (if (string-match (concat "^" (regexp-quote vm-folder-directory))
7014 folder) 7356 folder)
@@ -7026,12 +7368,25 @@ For file links, arg negates `org-context-in-file-links'."
7026 msgnum (wl-summary-buffer-msgdb))) 7368 msgnum (wl-summary-buffer-msgdb)))
7027 (author (wl-summary-line-from)) ; FIXME: how to get author name? 7369 (author (wl-summary-line-from)) ; FIXME: how to get author name?
7028 (subject "???")) ; FIXME: How to get subject of email? 7370 (subject "???")) ; FIXME: How to get subject of email?
7371 (setq message-id (org-remove-angle-brackets message-id))
7029 (setq cpltxt (concat author " on: " subject)) 7372 (setq cpltxt (concat author " on: " subject))
7030 (setq link (concat cpltxt "\n " 7373 (setq link (concat cpltxt "\n "
7031 (org-make-link 7374 (org-make-link
7032 "wl:" wl-summary-buffer-folder-name 7375 "wl:" wl-summary-buffer-folder-name
7033 "#" message-id))))) 7376 "#" message-id)))))
7034 7377
7378 ((or (equal major-mode 'mh-folder-mode)
7379 (equal major-mode 'mh-show-mode))
7380 (let ((from-header (org-mhe-get-header "From:"))
7381 (to-header (org-mhe-get-header "To:"))
7382 (subject (org-mhe-get-header "Subject:")))
7383 (setq cpltxt (concat from-header " on: " subject))
7384 (setq link (concat cpltxt "\n "
7385 (org-make-link
7386 "mhe:" (org-mhe-get-message-real-folder) "#"
7387 (org-remove-angle-brackets
7388 (org-mhe-get-header "Message-Id:")))))))
7389
7035 ((eq major-mode 'rmail-mode) 7390 ((eq major-mode 'rmail-mode)
7036 (save-excursion 7391 (save-excursion
7037 (save-restriction 7392 (save-restriction
@@ -7040,6 +7395,7 @@ For file links, arg negates `org-context-in-file-links'."
7040 (message-id (mail-fetch-field "message-id")) 7395 (message-id (mail-fetch-field "message-id"))
7041 (author (mail-fetch-field "from")) 7396 (author (mail-fetch-field "from"))
7042 (subject (mail-fetch-field "subject"))) 7397 (subject (mail-fetch-field "subject")))
7398 (setq message-id (org-remove-angle-brackets message-id))
7043 (setq cpltxt (concat author " on: " subject)) 7399 (setq cpltxt (concat author " on: " subject))
7044 (setq link (concat cpltxt "\n " 7400 (setq link (concat cpltxt "\n "
7045 (org-make-link 7401 (org-make-link
@@ -7093,19 +7449,26 @@ For file links, arg negates `org-context-in-file-links'."
7093 (abbreviate-file-name (buffer-file-name)))) 7449 (abbreviate-file-name (buffer-file-name))))
7094 ;; Add a context search string 7450 ;; Add a context search string
7095 (when (org-xor org-context-in-file-links arg) 7451 (when (org-xor org-context-in-file-links arg)
7452 ;; Check if we are on a target
7096 (if (save-excursion 7453 (if (save-excursion
7097 (skip-chars-backward "a-zA-Z<") 7454 (skip-chars-forward "^>\n\r")
7098 (looking-at (concat "<<\\(" org-camel-regexp "\\)>>"))) 7455 (and (re-search-backward "<<" nil t)
7456 (looking-at "<<\\(.*?\\)>>")
7457 (<= (match-beginning 0) pos)
7458 (>= (match-end 0) pos)))
7099 (setq cpltxt (concat cpltxt "::" (match-string 1))) 7459 (setq cpltxt (concat cpltxt "::" (match-string 1)))
7460 (setq txt (cond
7461 ((org-on-heading-p) nil)
7462 ((org-region-active-p)
7463 (buffer-substring (region-beginning) (region-end)))
7464 (t (buffer-substring (point-at-bol) (point-at-eol)))))
7100 (setq cpltxt 7465 (setq cpltxt
7101 (concat cpltxt "::" 7466 (concat cpltxt "::"
7102 (org-make-org-heading-camel 7467 (if org-file-link-context-use-camel-case
7103 (cond 7468 (org-make-org-heading-camel txt)
7104 ((org-on-heading-p) nil) 7469 (org-make-org-heading-search-string txt))))))
7105 ((org-region-active-p) 7470 (if (string-match "::\\'" cpltxt)
7106 (buffer-substring (region-beginning) (region-end))) 7471 (setq cpltxt (substring cpltxt 0 -2)))
7107 (t (buffer-substring (point-at-bol) (point-at-eol))))
7108 )))))
7109 (setq link (org-make-link cpltxt))) 7472 (setq link (org-make-link cpltxt)))
7110 7473
7111 ((buffer-file-name) 7474 ((buffer-file-name)
@@ -7114,19 +7477,21 @@ For file links, arg negates `org-context-in-file-links'."
7114 (abbreviate-file-name (buffer-file-name)))) 7477 (abbreviate-file-name (buffer-file-name))))
7115 ;; Add a context string 7478 ;; Add a context string
7116 (when (org-xor org-context-in-file-links arg) 7479 (when (org-xor org-context-in-file-links arg)
7480 (setq txt (if (org-region-active-p)
7481 (buffer-substring (region-beginning) (region-end))
7482 (buffer-substring (point-at-bol) (point-at-eol))))
7117 (setq cpltxt 7483 (setq cpltxt
7118 (concat cpltxt "::" 7484 (concat cpltxt "::"
7119 (org-make-org-heading-camel 7485 (if org-file-link-context-use-camel-case
7120 (if (org-region-active-p) 7486 (org-make-org-heading-camel txt)
7121 (buffer-substring (region-beginning) (region-end)) 7487 (org-make-org-heading-search-string txt)))))
7122 (buffer-substring (point-at-bol) (point-at-eol)))))))
7123 (setq link (org-make-link cpltxt))) 7488 (setq link (org-make-link cpltxt)))
7124 7489
7125 ((interactive-p) 7490 ((interactive-p)
7126 (error "Cannot link to a buffer which is not visiting a file")) 7491 (error "Cannot link to a buffer which is not visiting a file"))
7127 7492
7128 (t (setq link nil))) 7493 (t (setq link nil)))
7129 7494
7130 (if (and (interactive-p) link) 7495 (if (and (interactive-p) link)
7131 (progn 7496 (progn
7132 (setq org-stored-links 7497 (setq org-stored-links
@@ -7134,14 +7499,37 @@ For file links, arg negates `org-context-in-file-links'."
7134 (message "Stored: %s" (or cpltxt link))) 7499 (message "Stored: %s" (or cpltxt link)))
7135 link))) 7500 link)))
7136 7501
7137(defun org-make-org-heading-camel (&optional string) 7502(defun org-make-org-heading-search-string (&optional string heading)
7503 "Make search string for S or current headline."
7504 (interactive)
7505 (let ((s (or string (org-get-heading))))
7506 (unless (and string (not heading))
7507 ;; We are using a headline, clean up garbage in there.
7508 (if (string-match org-todo-regexp s)
7509 (setq s (replace-match "" t t s)))
7510 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
7511 (setq s (replace-match "" t t s)))
7512 (setq s (org-trim s))
7513 (if (string-match (concat "^\\(" org-quote-string "\\|"
7514 org-comment-string "\\)") s)
7515 (setq s (replace-match "" t t s)))
7516 (while (string-match org-ts-regexp s)
7517 (setq s (replace-match "" t t s))))
7518 (while (string-match "[^a-zA-Z_0-9 \t]+" s)
7519 (setq s (replace-match " " t t s)))
7520 (or string (setq s (concat "*" s))) ; Add * for headlines
7521 (mapconcat 'identity (org-split-string s "[ \t]+") " ")))
7522
7523(defun org-make-org-heading-camel (&optional string heading)
7138 "Make a CamelCase string for S or the current headline." 7524 "Make a CamelCase string for S or the current headline."
7139 (interactive) 7525 (interactive)
7140 (let ((s (or string (org-get-heading)))) 7526 (let ((s (or string (org-get-heading))))
7141 (unless string 7527 (unless (and string (not heading))
7142 ;; We are using a headline, clean up garbage in there. 7528 ;; We are using a headline, clean up garbage in there.
7143 (if (string-match org-todo-regexp s) 7529 (if (string-match org-todo-regexp s)
7144 (setq s (replace-match "" t t s))) 7530 (setq s (replace-match "" t t s)))
7531 (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s)
7532 (setq s (replace-match "" t t s)))
7145 (setq s (org-trim s)) 7533 (setq s (org-trim s))
7146 (if (string-match (concat "^\\(" org-quote-string "\\|" 7534 (if (string-match (concat "^\\(" org-quote-string "\\|"
7147 org-comment-string "\\)") s) 7535 org-comment-string "\\)") s)
@@ -7157,6 +7545,12 @@ For file links, arg negates `org-context-in-file-links'."
7157 "Concatenate STRINGS, format resulting string with `org-link-format'." 7545 "Concatenate STRINGS, format resulting string with `org-link-format'."
7158 (format org-link-format (apply 'concat strings))) 7546 (format org-link-format (apply 'concat strings)))
7159 7547
7548(defun org-make-link2 (link &optional description)
7549 "Make a link with brackets."
7550 (concat "[[" link "]"
7551 (if description (concat "[" description "]") "")
7552 "]"))
7553
7160(defun org-xor (a b) 7554(defun org-xor (a b)
7161 "Exclusive or." 7555 "Exclusive or."
7162 (if a (not b) b)) 7556 (if a (not b) b))
@@ -7245,15 +7639,18 @@ is in the current directory or below."
7245 (let* ((path (match-string 1 link)) 7639 (let* ((path (match-string 1 link))
7246 (case-fold-search nil) 7640 (case-fold-search nil)
7247 (search (match-string 2 link))) 7641 (search (match-string 2 link)))
7248 (when (save-match-data 7642 (when (save-match-data
7249 (equal (file-truename (buffer-file-name)) 7643 (equal (file-truename (buffer-file-name))
7250 (file-truename path))) 7644 (file-truename path)))
7251 (if (save-match-data 7645 ;; We are linking to this same file
7252 (string-match (concat "^" org-camel-regexp "$") search)) 7646 (if (and org-file-link-context-use-camel-case
7253 (setq link (replace-match search t t link) 7647 (save-match-data
7254 matched t) 7648 (string-match (concat "^" org-camel-regexp "$") search)))
7255 (setq link (replace-match (concat "<file:::" search ">") 7649 (setq link (replace-match search t t link)
7256 t t link)))))) 7650 matched t)
7651 (setq link (replace-match (concat "[[" search "]]")
7652 t t link)
7653 matched t)))))
7257 (let ((lines (org-split-string link "\n"))) 7654 (let ((lines (org-split-string link "\n")))
7258 (insert (car lines)) 7655 (insert (car lines))
7259 (setq matched (or matched (string-match org-link-regexp (car lines)))) 7656 (setq matched (or matched (string-match org-link-regexp (car lines))))
@@ -9467,9 +9864,8 @@ table editor in arbitrary modes.")
9467 (and c (setq minor-mode-map-alist 9864 (and c (setq minor-mode-map-alist
9468 (cons c (delq c minor-mode-map-alist))))) 9865 (cons c (delq c minor-mode-map-alist)))))
9469 (set (make-local-variable (quote org-table-may-need-update)) t) 9866 (set (make-local-variable (quote org-table-may-need-update)) t)
9470 (make-local-hook (quote before-change-functions)) ; needed for XEmacs 9867 (org-add-hook 'before-change-functions 'org-before-change-function
9471 (add-hook 'before-change-functions 'org-before-change-function 9868 nil 'local)
9472 nil 'local)
9473 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) 9869 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
9474 auto-fill-inhibit-regexp) 9870 auto-fill-inhibit-regexp)
9475 (set (make-local-variable 'auto-fill-inhibit-regexp) 9871 (set (make-local-variable 'auto-fill-inhibit-regexp)
@@ -9734,6 +10130,10 @@ a reduced column width."
9734 ((string-match "^#" line) 10130 ((string-match "^#" line)
9735 ;; an ordinary comment line 10131 ;; an ordinary comment line
9736 ) 10132 )
10133 ((and org-export-table-remove-special-lines
10134 (string-match "^[ \t]*| *[!_^] *|" line))
10135 ;; a special table line that should be removed
10136 )
9737 (t (setq rtn (cons line rtn))))) 10137 (t (setq rtn (cons line rtn)))))
9738 (nreverse rtn))) 10138 (nreverse rtn)))
9739 10139
@@ -10587,7 +10987,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10587 (concat "<a href=\"" thefile "\">\\1:\\2</a>")) 10987 (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
10588 nil nil line)))) 10988 nil nil line))))
10589 10989
10590 ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell")) 10990 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
10591 (setq line (replace-match 10991 (setq line (replace-match
10592 "<i>&lt;\\1:\\2&gt;</i>" nil nil line))))) 10992 "<i>&lt;\\1:\\2&gt;</i>" nil nil line)))))
10593 10993
@@ -10727,6 +11127,29 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10727 (setq lines (nreverse lines)) 11127 (setq lines (nreverse lines))
10728 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) 11128 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
10729 (setq lines (nreverse lines)) 11129 (setq lines (nreverse lines))
11130 (when org-export-table-remove-special-lines
11131 ;; Check if the table has a marking column. If yes remove the
11132 ;; column and the special lines
11133 (let* ((special
11134 (not
11135 (memq nil
11136 (mapcar
11137 (lambda (x)
11138 (or (string-match "^[ \t]*|-" x)
11139 (string-match "^[ \t]*| *\\([#!$*_^ ]\\) *|" x)))
11140 lines)))))
11141 (if special
11142 (setq lines
11143 (delq nil
11144 (mapcar
11145 (lambda (x)
11146 (if (string-match "^[ \t]*| *[!_^] *|" x)
11147 nil ; ignore this line
11148 (and (or (string-match "^[ \t]*|-+\\+" x)
11149 (string-match "^[ \t]*|[^|]*|" x))
11150 (replace-match "|" t t x))))
11151 lines))))))
11152
10730 (let ((head (and org-export-highlight-first-table-line 11153 (let ((head (and org-export-highlight-first-table-line
10731 (delq nil (mapcar 11154 (delq nil (mapcar
10732 (lambda (x) (string-match "^[ \t]*|-" x)) 11155 (lambda (x) (string-match "^[ \t]*|-" x))
@@ -11210,10 +11633,10 @@ a time), or the day by one (if it does not contain a time)."
11210 11633
11211;; - Bindings in Org-mode map are currently 11634;; - Bindings in Org-mode map are currently
11212;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet 11635;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet
11213;; abcd fgh j lmnopqrstuvwxyz!? #$ -+*/= [] ; |,.<>~ \t necessary bindings 11636;; abcd fgh j lmnopqrstuvwxyz!? #$ ^ -+*/= [] ; |,.<>~ '\t necessary bindings
11214;; e (?) useful from outline-mode 11637;; e (?) useful from outline-mode
11215;; i k @ expendable from outline-mode 11638;; i k @ expendable from outline-mode
11216;; 0123456789 %^& ()_{} " `' free 11639;; 0123456789 % & ()_{} " ` free
11217 11640
11218;; Make `C-c C-x' a prefix key 11641;; Make `C-c C-x' a prefix key
11219(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) 11642(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
@@ -11281,6 +11704,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) 11704(define-key org-mode-map "\M-\C-m" 'org-insert-heading)
11282(define-key org-mode-map "\C-c\C-l" 'org-insert-link) 11705(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) 11706(define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
11707(define-key org-mode-map "\C-c%" 'org-mark-ring-push)
11708(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 11709(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 11710(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. 11711(define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
@@ -11594,6 +12019,7 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
11594 (interactive "P") 12019 (interactive "P")
11595 (let ((org-enable-table-editor t)) 12020 (let ((org-enable-table-editor t))
11596 (cond 12021 (cond
12022 ((org-on-target-p) (org-update-radio-target-regexp))
11597 ((org-on-heading-p) (org-set-tags arg)) 12023 ((org-on-heading-p) (org-set-tags arg))
11598 ((org-at-table.el-p) 12024 ((org-at-table.el-p)
11599 (require 'table) 12025 (require 'table)
@@ -11935,6 +12361,11 @@ work correctly."
11935 12361
11936;; Functions needed for Emacs/XEmacs region compatibility 12362;; Functions needed for Emacs/XEmacs region compatibility
11937 12363
12364(defun org-add-hook (hook function &optional append local)
12365 "Add-hook, compatible with both Emacsen."
12366 (if (and local org-xemacs-p) (make-local-hook hook)) ;; Needed for XEmacs
12367 (add-hook hook function append local))
12368
11938(defun org-region-active-p () 12369(defun org-region-active-p ()
11939 "Is `transient-mark-mode' on and the region active? 12370 "Is `transient-mark-mode' on and the region active?
11940Works on both Emacs and XEmacs." 12371Works on both Emacs and XEmacs."
@@ -12030,6 +12461,19 @@ to a visible line beginning. This makes the function of C-a more intuitive."
12030 (skip-chars-backward "^\r\n") 12461 (skip-chars-backward "^\r\n")
12031 (equal (char-before) ?\r)))) 12462 (equal (char-before) ?\r))))
12032 12463
12464(defun org-invisible-p2 ()
12465 "Check if point is at a character currently not visible."
12466 (save-excursion
12467 (if org-noutline-p
12468 (progn
12469 (if (and (eolp) (not (bobp))) (backward-char 1))
12470 ;; Early versions of noutline don't have `outline-invisible-p'.
12471 (if (fboundp 'outline-invisible-p)
12472 (outline-invisible-p)
12473 (get-char-property (point) 'invisible)))
12474 (skip-chars-backward "^\r\n")
12475 (equal (char-before) ?\r))))
12476
12033(defun org-back-to-heading (&optional invisible-ok) 12477(defun org-back-to-heading (&optional invisible-ok)
12034 "Move to previous heading line, or beg of this line if it's a heading. 12478 "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." 12479Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
@@ -12058,6 +12502,16 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
12058 (bobp) 12502 (bobp)
12059 (equal (char-before) ?\n)))))) 12503 (equal (char-before) ?\n))))))
12060 12504
12505(defun org-on-target-p ()
12506 (let ((pos (point)))
12507 (save-excursion
12508 (skip-chars-forward "<")
12509 (and (re-search-backward "<<" nil t)
12510 (or (looking-at org-target-regexp)
12511 (looking-at org-radio-target-regexp))
12512 (<= (match-beginning 0) pos)
12513 (>= (match-end 0) pos)))))
12514
12061(defun org-up-heading-all (arg) 12515(defun org-up-heading-all (arg)
12062 "Move to the heading line of which the present line is a subheading. 12516 "Move to the heading line of which the present line is a subheading.
12063This function considers both visible and invisible heading lines. 12517This function considers both visible and invisible heading lines.
@@ -12195,4 +12649,3 @@ Show the heading too, if it is currently invisible."
12195;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 12649;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12196;;; org.el ends here 12650;;; org.el ends here
12197 12651
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))))