diff options
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/fill.el | 96 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 292 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 27 | ||||
| -rw-r--r-- | lisp/textmodes/org.el | 935 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-toc.el | 50 | ||||
| -rw-r--r-- | lisp/textmodes/reftex.el | 178 | ||||
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 6 | ||||
| -rw-r--r-- | lisp/textmodes/table.el | 10 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 32 | ||||
| -rw-r--r-- | lisp/textmodes/texinfo.el | 8 |
10 files changed, 928 insertions, 706 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 1615da60910..7d4ee6ec00d 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; fill.el --- fill commands for Emacs -*- coding: iso-2022-7bit -*- | 1 | ;;; fill.el --- fill commands for Emacs -*- coding: iso-2022-7bit -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985,86,92,94,95,96,97,1999,2001,02,03,2004 | 3 | ;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1999, 2001, 2002, |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; 2003, 2004, 2005 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| 7 | ;; Keywords: wp | 7 | ;; Keywords: wp |
| @@ -115,7 +115,7 @@ if it would act as a paragraph-starter on the second line." | |||
| 115 | 115 | ||
| 116 | (defcustom adaptive-fill-function nil | 116 | (defcustom adaptive-fill-function nil |
| 117 | "*Function to call to choose a fill prefix for a paragraph, or nil. | 117 | "*Function to call to choose a fill prefix for a paragraph, or nil. |
| 118 | This function is used when `adaptive-fill-regexp' does not match." | 118 | nil means the function has not determined the fill prefix." |
| 119 | :type '(choice (const nil) function) | 119 | :type '(choice (const nil) function) |
| 120 | :group 'fill) | 120 | :group 'fill) |
| 121 | 121 | ||
| @@ -205,6 +205,16 @@ Remove indentation from each line." | |||
| 205 | (unless (zerop cmp) | 205 | (unless (zerop cmp) |
| 206 | (substring s1 0 cmp))))) | 206 | (substring s1 0 cmp))))) |
| 207 | 207 | ||
| 208 | (defun fill-match-adaptive-prefix () | ||
| 209 | (let ((str (or | ||
| 210 | (and adaptive-fill-function (funcall adaptive-fill-function)) | ||
| 211 | (and adaptive-fill-regexp (looking-at adaptive-fill-regexp) | ||
| 212 | (match-string-no-properties 0))))) | ||
| 213 | (if (>= (+ (current-left-margin) (length str)) (current-fill-column)) | ||
| 214 | ;; Death to insanely long prefixes. | ||
| 215 | nil | ||
| 216 | str))) | ||
| 217 | |||
| 208 | (defun fill-context-prefix (from to &optional first-line-regexp) | 218 | (defun fill-context-prefix (from to &optional first-line-regexp) |
| 209 | "Compute a fill prefix from the text between FROM and TO. | 219 | "Compute a fill prefix from the text between FROM and TO. |
| 210 | This uses the variables `adaptive-fill-regexp' and `adaptive-fill-function' | 220 | This uses the variables `adaptive-fill-regexp' and `adaptive-fill-function' |
| @@ -218,55 +228,45 @@ act as a paragraph-separator." | |||
| 218 | (if (eolp) (forward-line 1)) | 228 | (if (eolp) (forward-line 1)) |
| 219 | ;; Move to the second line unless there is just one. | 229 | ;; Move to the second line unless there is just one. |
| 220 | (move-to-left-margin) | 230 | (move-to-left-margin) |
| 221 | (let ((firstline (point)) | 231 | (let (first-line-prefix |
| 222 | first-line-prefix | ||
| 223 | ;; Non-nil if we are on the second line. | 232 | ;; Non-nil if we are on the second line. |
| 224 | second-line-prefix | 233 | second-line-prefix) |
| 225 | start) | ||
| 226 | (setq start (point)) | ||
| 227 | (setq first-line-prefix | 234 | (setq first-line-prefix |
| 228 | ;; We don't need to consider `paragraph-start' here since it | 235 | ;; We don't need to consider `paragraph-start' here since it |
| 229 | ;; will be explicitly checked later on. | 236 | ;; will be explicitly checked later on. |
| 230 | ;; Also setting first-line-prefix to nil prevents | 237 | ;; Also setting first-line-prefix to nil prevents |
| 231 | ;; second-line-prefix from being used. | 238 | ;; second-line-prefix from being used. |
| 232 | (cond ;; ((looking-at paragraph-start) nil) | 239 | ;; ((looking-at paragraph-start) nil) |
| 233 | ((and adaptive-fill-regexp (looking-at adaptive-fill-regexp)) | 240 | (fill-match-adaptive-prefix)) |
| 234 | (match-string-no-properties 0)) | ||
| 235 | (adaptive-fill-function (funcall adaptive-fill-function)))) | ||
| 236 | (forward-line 1) | 241 | (forward-line 1) |
| 237 | (if (< (point) to) | 242 | (if (< (point) to) |
| 238 | (progn | 243 | (progn |
| 239 | (move-to-left-margin) | 244 | (move-to-left-margin) |
| 240 | (setq start (point)) | 245 | (setq second-line-prefix |
| 241 | (setq second-line-prefix | 246 | (cond ((looking-at paragraph-start) nil) ;Can it happen? -Stef |
| 242 | (cond ((looking-at paragraph-start) nil) ;Can it happen ? -stef | 247 | (t (fill-match-adaptive-prefix)))) |
| 243 | ((and adaptive-fill-regexp | 248 | ;; If we get a fill prefix from the second line, |
| 244 | (looking-at adaptive-fill-regexp)) | 249 | ;; make sure it or something compatible is on the first line too. |
| 245 | (buffer-substring-no-properties start (match-end 0))) | 250 | (when second-line-prefix |
| 246 | (adaptive-fill-function | 251 | (unless first-line-prefix (setq first-line-prefix "")) |
| 247 | (funcall adaptive-fill-function)))) | 252 | ;; If the non-whitespace chars match the first line, |
| 248 | ;; If we get a fill prefix from the second line, | 253 | ;; just use it (this subsumes the 2 checks used previously). |
| 249 | ;; make sure it or something compatible is on the first line too. | 254 | ;; Used when first line is `/* ...' and second-line is |
| 250 | (when second-line-prefix | 255 | ;; ` * ...'. |
| 251 | (unless first-line-prefix (setq first-line-prefix "")) | 256 | (let ((tmp second-line-prefix) |
| 252 | ;; If the non-whitespace chars match the first line, | 257 | (re "\\`")) |
| 253 | ;; just use it (this subsumes the 2 checks used previously). | 258 | (while (string-match "\\`[ \t]*\\([^ \t]+\\)" tmp) |
| 254 | ;; Used when first line is `/* ...' and second-line is | 259 | (setq re (concat re ".*" (regexp-quote (match-string 1 tmp)))) |
| 255 | ;; ` * ...'. | 260 | (setq tmp (substring tmp (match-end 0)))) |
| 256 | (let ((tmp second-line-prefix) | 261 | ;; (assert (string-match "\\`[ \t]*\\'" tmp)) |
| 257 | (re "\\`")) | 262 | |
| 258 | (while (string-match "\\`[ \t]*\\([^ \t]+\\)" tmp) | 263 | (if (string-match re first-line-prefix) |
| 259 | (setq re (concat re ".*" (regexp-quote (match-string 1 tmp)))) | 264 | second-line-prefix |
| 260 | (setq tmp (substring tmp (match-end 0)))) | 265 | |
| 261 | ;; (assert (string-match "\\`[ \t]*\\'" tmp)) | 266 | ;; Use the longest common substring of both prefixes, |
| 262 | 267 | ;; if there is one. | |
| 263 | (if (string-match re first-line-prefix) | 268 | (fill-common-string-prefix first-line-prefix |
| 264 | second-line-prefix | 269 | second-line-prefix))))) |
| 265 | |||
| 266 | ;; Use the longest common substring of both prefixes, | ||
| 267 | ;; if there is one. | ||
| 268 | (fill-common-string-prefix first-line-prefix | ||
| 269 | second-line-prefix))))) | ||
| 270 | ;; If we get a fill prefix from a one-line paragraph, | 270 | ;; If we get a fill prefix from a one-line paragraph, |
| 271 | ;; maybe change it to whitespace, | 271 | ;; maybe change it to whitespace, |
| 272 | ;; and check that it isn't a paragraph starter. | 272 | ;; and check that it isn't a paragraph starter. |
| @@ -333,7 +333,7 @@ be tested. If it returns t, fill commands do not break the line there." | |||
| 333 | Can be customized with the variables `fill-nobreak-predicate' | 333 | Can be customized with the variables `fill-nobreak-predicate' |
| 334 | and `fill-nobreak-invisible'." | 334 | and `fill-nobreak-invisible'." |
| 335 | (or | 335 | (or |
| 336 | (and fill-nobreak-invisible (line-move-invisible (point))) | 336 | (and fill-nobreak-invisible (line-move-invisible-p (point))) |
| 337 | (unless (bolp) | 337 | (unless (bolp) |
| 338 | (or | 338 | (or |
| 339 | ;; Don't break after a period followed by just one space. | 339 | ;; Don't break after a period followed by just one space. |
| @@ -1128,8 +1128,6 @@ otherwise it is made canonical." | |||
| 1128 | ncols ; new indent point or offset | 1128 | ncols ; new indent point or offset |
| 1129 | (nspaces 0) ; number of spaces between words | 1129 | (nspaces 0) ; number of spaces between words |
| 1130 | ; in line (not space characters) | 1130 | ; in line (not space characters) |
| 1131 | fracspace ; fractional amount of space to be | ||
| 1132 | ; added between each words | ||
| 1133 | (curr-fracspace 0) ; current fractional space amount | 1131 | (curr-fracspace 0) ; current fractional space amount |
| 1134 | count) | 1132 | count) |
| 1135 | (end-of-line) | 1133 | (end-of-line) |
| @@ -1338,7 +1336,7 @@ Also, if CITATION-REGEXP is non-nil, don't fill header lines." | |||
| 1338 | (forward-line 1)))) | 1336 | (forward-line 1)))) |
| 1339 | (narrow-to-region (point) max) | 1337 | (narrow-to-region (point) max) |
| 1340 | ;; Loop over paragraphs. | 1338 | ;; Loop over paragraphs. |
| 1341 | (while (let ((here (point))) | 1339 | (while (progn |
| 1342 | ;; Skip over all paragraph-separating lines | 1340 | ;; Skip over all paragraph-separating lines |
| 1343 | ;; so as to not include them in any paragraph. | 1341 | ;; so as to not include them in any paragraph. |
| 1344 | (while (and (not (eobp)) | 1342 | (while (and (not (eobp)) |
| @@ -1446,5 +1444,5 @@ Also, if CITATION-REGEXP is non-nil, don't fill header lines." | |||
| 1446 | "") | 1444 | "") |
| 1447 | string)) | 1445 | string)) |
| 1448 | 1446 | ||
| 1449 | ;;; arch-tag: 727ad455-1161-4fa9-8df5-0f74b179216d | 1447 | ;; arch-tag: 727ad455-1161-4fa9-8df5-0f74b179216d |
| 1450 | ;;; fill.el ends here | 1448 | ;;; fill.el ends here |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 0b65993df3c..8c2d0937a5a 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -94,7 +94,7 @@ Non-nil means use highlight, nil means use minibuffer messages." | |||
| 94 | "*The maximum distance for finding duplicates of unrecognized words. | 94 | "*The maximum distance for finding duplicates of unrecognized words. |
| 95 | This applies to the feature that when a word is not found in the dictionary, | 95 | This applies to the feature that when a word is not found in the dictionary, |
| 96 | if the same spelling occurs elsewhere in the buffer, | 96 | if the same spelling occurs elsewhere in the buffer, |
| 97 | Flyspell uses a different face (`flyspell-duplicate-face') to highlight it. | 97 | Flyspell uses a different face (`flyspell-duplicate') to highlight it. |
| 98 | This variable specifies how far to search to find such a duplicate. | 98 | This variable specifies how far to search to find such a duplicate. |
| 99 | -1 means no limit (search the whole buffer). | 99 | -1 means no limit (search the whole buffer). |
| 100 | 0 means do not search for duplicate unrecognized spellings." | 100 | 0 means do not search for duplicate unrecognized spellings." |
| @@ -172,7 +172,7 @@ command was not the very same command." | |||
| 172 | "*List of functions to be called when incorrect words are encountered. | 172 | "*List of functions to be called when incorrect words are encountered. |
| 173 | Each function is given three arguments: the beginning and the end | 173 | Each function is given three arguments: the beginning and the end |
| 174 | of the incorrect region. The third is either the symbol 'doublon' or the list | 174 | of the incorrect region. The third is either the symbol 'doublon' or the list |
| 175 | of possible corrections as returned by 'ispell-parse-output'. | 175 | of possible corrections as returned by `ispell-parse-output'. |
| 176 | 176 | ||
| 177 | If any of the functions return non-Nil, the word is not highlighted as | 177 | If any of the functions return non-Nil, the word is not highlighted as |
| 178 | incorrect." | 178 | incorrect." |
| @@ -228,7 +228,6 @@ http://strw.leidenuniv.nl/~dominik/Tools" | |||
| 228 | :version "21.1" | 228 | :version "21.1" |
| 229 | :type 'boolean) | 229 | :type 'boolean) |
| 230 | 230 | ||
| 231 | ;;;###autoload | ||
| 232 | (defcustom flyspell-mode-line-string " Fly" | 231 | (defcustom flyspell-mode-line-string " Fly" |
| 233 | "*String displayed on the modeline when flyspell is active. | 232 | "*String displayed on the modeline when flyspell is active. |
| 234 | Set this to nil if you don't want a modeline indicator." | 233 | Set this to nil if you don't want a modeline indicator." |
| @@ -268,11 +267,7 @@ If `flyspell-large-region' is nil, all regions are treated as small." | |||
| 268 | :type 'boolean) | 267 | :type 'boolean) |
| 269 | 268 | ||
| 270 | (defcustom flyspell-auto-correct-binding | 269 | (defcustom flyspell-auto-correct-binding |
| 271 | (cond | 270 | [(control ?\;)] |
| 272 | ((eq flyspell-emacs 'xemacs) | ||
| 273 | [(control \;)]) | ||
| 274 | (t | ||
| 275 | [?\C-\;])) | ||
| 276 | "The key binding for flyspell auto correction." | 271 | "The key binding for flyspell auto correction." |
| 277 | :group 'flyspell) | 272 | :group 'flyspell) |
| 278 | 273 | ||
| @@ -410,10 +405,6 @@ property of the major mode name.") | |||
| 410 | ;*---------------------------------------------------------------------*/ | 405 | ;*---------------------------------------------------------------------*/ |
| 411 | (eval-when-compile (defvar flyspell-local-mouse-map)) | 406 | (eval-when-compile (defvar flyspell-local-mouse-map)) |
| 412 | 407 | ||
| 413 | ;;;###autoload | ||
| 414 | (defvar flyspell-mode nil) | ||
| 415 | (make-variable-buffer-local 'flyspell-mode) | ||
| 416 | |||
| 417 | (defvar flyspell-mouse-map | 408 | (defvar flyspell-mouse-map |
| 418 | (let ((map (make-sparse-keymap))) | 409 | (let ((map (make-sparse-keymap))) |
| 419 | (if flyspell-use-meta-tab | 410 | (if flyspell-use-meta-tab |
| @@ -425,26 +416,18 @@ property of the major mode name.") | |||
| 425 | (define-key map [(control \.)] 'flyspell-auto-correct-word) | 416 | (define-key map [(control \.)] 'flyspell-auto-correct-word) |
| 426 | map)) | 417 | map)) |
| 427 | 418 | ||
| 428 | ;;;###autoload | 419 | (defvar flyspell-mode-map |
| 429 | (defvar flyspell-mode-map (make-sparse-keymap)) | 420 | (let ((map (make-sparse-keymap))) |
| 430 | 421 | ;; mouse, keyboard bindings and misc definition | |
| 431 | ;; mouse, keyboard bindings and misc definition | 422 | (if flyspell-use-meta-tab |
| 432 | (when (or (assoc 'flyspell-mode minor-mode-map-alist) | 423 | (define-key map "\M-\t" 'flyspell-auto-correct-word)) |
| 433 | (setq minor-mode-map-alist | 424 | (cond |
| 434 | (cons (cons 'flyspell-mode flyspell-mode-map) | 425 | ;; I don't understand this test, so I left it as is. --Stef |
| 435 | minor-mode-map-alist))) | 426 | ((or (featurep 'xemacs) flyspell-use-local-map) |
| 436 | (if flyspell-use-meta-tab | 427 | (define-key map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) |
| 437 | (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word)) | 428 | (define-key map [(control ?\,)] 'flyspell-goto-next-error) |
| 438 | (cond | 429 | (define-key map [(control ?\.)] 'flyspell-auto-correct-word))) |
| 439 | ((eq flyspell-emacs 'xemacs) | 430 | map)) |
| 440 | (define-key flyspell-mode-map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) | ||
| 441 | (define-key flyspell-mode-map [(control \,)] 'flyspell-goto-next-error) | ||
| 442 | (define-key flyspell-mode-map [(control \.)] 'flyspell-auto-correct-word)) | ||
| 443 | (flyspell-use-local-map | ||
| 444 | (define-key flyspell-mode-map flyspell-auto-correct-binding 'flyspell-auto-correct-previous-word) | ||
| 445 | (define-key flyspell-mode-map [?\C-\,] 'flyspell-goto-next-error) | ||
| 446 | (define-key flyspell-mode-map [?\C-\.] 'flyspell-auto-correct-word)))) | ||
| 447 | |||
| 448 | 431 | ||
| 449 | ;; the name of the overlay property that defines the keymap | 432 | ;; the name of the overlay property that defines the keymap |
| 450 | (defvar flyspell-overlay-keymap-property-name 'keymap) | 433 | (defvar flyspell-overlay-keymap-property-name 'keymap) |
| @@ -461,24 +444,22 @@ property of the major mode name.") | |||
| 461 | ;*---------------------------------------------------------------------*/ | 444 | ;*---------------------------------------------------------------------*/ |
| 462 | ;* Highlighting */ | 445 | ;* Highlighting */ |
| 463 | ;*---------------------------------------------------------------------*/ | 446 | ;*---------------------------------------------------------------------*/ |
| 464 | (defface flyspell-incorrect-face | 447 | (defface flyspell-incorrect |
| 465 | (if (eq flyspell-emacs 'xemacs) | 448 | '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) |
| 466 | '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) | 449 | (t (:bold t))) |
| 467 | (t (:bold t))) | ||
| 468 | '((((class color)) (:foreground "OrangeRed" :weight bold :underline t)) | ||
| 469 | (t (:weight bold)))) | ||
| 470 | "Face used for marking a misspelled word in Flyspell." | 450 | "Face used for marking a misspelled word in Flyspell." |
| 471 | :group 'flyspell) | 451 | :group 'flyspell) |
| 452 | ;; backward-compatibility alias | ||
| 453 | (put 'flyspell-incorrect-face 'face-alias 'flyspell-incorrect) | ||
| 472 | 454 | ||
| 473 | (defface flyspell-duplicate-face | 455 | (defface flyspell-duplicate |
| 474 | (if (eq flyspell-emacs 'xemacs) | 456 | '((((class color)) (:foreground "Gold3" :bold t :underline t)) |
| 475 | '((((class color)) (:foreground "Gold3" :bold t :underline t)) | 457 | (t (:bold t))) |
| 476 | (t (:bold t))) | ||
| 477 | '((((class color)) (:foreground "Gold3" :weight bold :underline t)) | ||
| 478 | (t (:weight bold)))) | ||
| 479 | "Face used for marking a misspelled word that appears twice in the buffer. | 458 | "Face used for marking a misspelled word that appears twice in the buffer. |
| 480 | See also `flyspell-duplicate-distance'." | 459 | See also `flyspell-duplicate-distance'." |
| 481 | :group 'flyspell) | 460 | :group 'flyspell) |
| 461 | ;; backward-compatibility alias | ||
| 462 | (put 'flyspell-duplicate-face 'face-alias 'flyspell-duplicate) | ||
| 482 | 463 | ||
| 483 | (defvar flyspell-overlay nil) | 464 | (defvar flyspell-overlay nil) |
| 484 | 465 | ||
| @@ -486,7 +467,7 @@ See also `flyspell-duplicate-distance'." | |||
| 486 | ;* flyspell-mode ... */ | 467 | ;* flyspell-mode ... */ |
| 487 | ;*---------------------------------------------------------------------*/ | 468 | ;*---------------------------------------------------------------------*/ |
| 488 | ;;;###autoload | 469 | ;;;###autoload |
| 489 | (defun flyspell-mode (&optional arg) | 470 | (define-minor-mode flyspell-mode |
| 490 | "Minor mode performing on-the-fly spelling checking. | 471 | "Minor mode performing on-the-fly spelling checking. |
| 491 | This spawns a single Ispell process and checks each word. | 472 | This spawns a single Ispell process and checks each word. |
| 492 | The default flyspell behavior is to highlight incorrect words. | 473 | The default flyspell behavior is to highlight incorrect words. |
| @@ -514,28 +495,12 @@ in your .emacs file. | |||
| 514 | 495 | ||
| 515 | \\[flyspell-region] checks all words inside a region. | 496 | \\[flyspell-region] checks all words inside a region. |
| 516 | \\[flyspell-buffer] checks the whole buffer." | 497 | \\[flyspell-buffer] checks the whole buffer." |
| 517 | (interactive "P") | 498 | :lighter flyspell-mode-line-string |
| 518 | (let ((old-flyspell-mode flyspell-mode)) | 499 | :keymap flyspell-mode-map |
| 519 | ;; Mark the mode as on or off. | 500 | :group 'flyspell |
| 520 | (setq flyspell-mode (not (or (and (null arg) flyspell-mode) | 501 | (if flyspell-mode |
| 521 | (<= (prefix-numeric-value arg) 0)))) | 502 | (flyspell-mode-on) |
| 522 | ;; Do the real work. | 503 | (flyspell-mode-off))) |
| 523 | (unless (eq flyspell-mode old-flyspell-mode) | ||
| 524 | (if flyspell-mode | ||
| 525 | (flyspell-mode-on) | ||
| 526 | (flyspell-mode-off)) | ||
| 527 | ;; Force modeline redisplay. | ||
| 528 | (set-buffer-modified-p (buffer-modified-p))))) | ||
| 529 | |||
| 530 | ;*---------------------------------------------------------------------*/ | ||
| 531 | ;* Autoloading */ | ||
| 532 | ;*---------------------------------------------------------------------*/ | ||
| 533 | ;;;###autoload | ||
| 534 | (add-minor-mode 'flyspell-mode | ||
| 535 | 'flyspell-mode-line-string | ||
| 536 | flyspell-mode-map | ||
| 537 | nil | ||
| 538 | 'flyspell-mode) | ||
| 539 | 504 | ||
| 540 | ;*---------------------------------------------------------------------*/ | 505 | ;*---------------------------------------------------------------------*/ |
| 541 | ;* flyspell-buffers ... */ | 506 | ;* flyspell-buffers ... */ |
| @@ -579,7 +544,7 @@ in your .emacs file. | |||
| 579 | ;*---------------------------------------------------------------------*/ | 544 | ;*---------------------------------------------------------------------*/ |
| 580 | (defun flyspell-mode-on () | 545 | (defun flyspell-mode-on () |
| 581 | "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." | 546 | "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." |
| 582 | (setq ispell-highlight-face 'flyspell-incorrect-face) | 547 | (setq ispell-highlight-face 'flyspell-incorrect) |
| 583 | ;; local dictionaries setup | 548 | ;; local dictionaries setup |
| 584 | (or ispell-local-dictionary ispell-dictionary | 549 | (or ispell-local-dictionary ispell-dictionary |
| 585 | (if flyspell-default-dictionary | 550 | (if flyspell-default-dictionary |
| @@ -830,9 +795,7 @@ Mostly we check word delimiters." | |||
| 830 | ((get this-command 'flyspell-delayed) | 795 | ((get this-command 'flyspell-delayed) |
| 831 | ;; the current command is not delayed, that | 796 | ;; the current command is not delayed, that |
| 832 | ;; is that we must check the word now | 797 | ;; is that we must check the word now |
| 833 | (if (fboundp 'about-xemacs) | 798 | (sit-for flyspell-delay)) |
| 834 | (sit-for flyspell-delay nil) | ||
| 835 | (sit-for flyspell-delay 0 nil))) | ||
| 836 | (t t))) | 799 | (t t))) |
| 837 | (t t))) | 800 | (t t))) |
| 838 | 801 | ||
| @@ -1019,7 +982,7 @@ Mostly we check word delimiters." | |||
| 1019 | (setq r p) | 982 | (setq r p) |
| 1020 | (goto-char p)))) | 983 | (goto-char p)))) |
| 1021 | r))) | 984 | r))) |
| 1022 | 985 | ||
| 1023 | ;*---------------------------------------------------------------------*/ | 986 | ;*---------------------------------------------------------------------*/ |
| 1024 | ;* flyspell-word-search-forward ... */ | 987 | ;* flyspell-word-search-forward ... */ |
| 1025 | ;*---------------------------------------------------------------------*/ | 988 | ;*---------------------------------------------------------------------*/ |
| @@ -1033,7 +996,7 @@ Mostly we check word delimiters." | |||
| 1033 | (setq r p) | 996 | (setq r p) |
| 1034 | (goto-char (1+ p))))) | 997 | (goto-char (1+ p))))) |
| 1035 | r))) | 998 | r))) |
| 1036 | 999 | ||
| 1037 | ;*---------------------------------------------------------------------*/ | 1000 | ;*---------------------------------------------------------------------*/ |
| 1038 | ;* flyspell-word ... */ | 1001 | ;* flyspell-word ... */ |
| 1039 | ;*---------------------------------------------------------------------*/ | 1002 | ;*---------------------------------------------------------------------*/ |
| @@ -1059,12 +1022,11 @@ Mostly we check word delimiters." | |||
| 1059 | (cond | 1022 | (cond |
| 1060 | ((and (or (not (eq ispell-parser 'tex)) | 1023 | ((and (or (not (eq ispell-parser 'tex)) |
| 1061 | (and (> start (point-min)) | 1024 | (and (> start (point-min)) |
| 1062 | (not (eq (char-after (1- start)) ?})) | 1025 | (not (memq (char-after (1- start)) '(?\} ?\\))))) |
| 1063 | (not (eq (char-after (1- start)) ?\\)))) | ||
| 1064 | flyspell-mark-duplications-flag | 1026 | flyspell-mark-duplications-flag |
| 1065 | (save-excursion | 1027 | (save-excursion |
| 1066 | (goto-char (1- start)) | 1028 | (goto-char (1- start)) |
| 1067 | (let ((p (flyspell-word-search-backward | 1029 | (let ((p (flyspell-word-search-backward |
| 1068 | word | 1030 | word |
| 1069 | (- start (1+ (- end start)))))) | 1031 | (- start (1+ (- end start)))))) |
| 1070 | (and p (/= p (1- start)))))) | 1032 | (and p (/= p (1- start)))))) |
| @@ -1164,7 +1126,7 @@ Mostly we check word delimiters." | |||
| 1164 | (flyspell-notify-misspell start end word poss)) | 1126 | (flyspell-notify-misspell start end word poss)) |
| 1165 | nil)))) | 1127 | nil)))) |
| 1166 | ;; return to original location | 1128 | ;; return to original location |
| 1167 | (goto-char cursor-location) | 1129 | (goto-char cursor-location) |
| 1168 | (if ispell-quit (setq ispell-quit nil)) | 1130 | (if ispell-quit (setq ispell-quit nil)) |
| 1169 | res)))))))) | 1131 | res)))))))) |
| 1170 | 1132 | ||
| @@ -1183,20 +1145,21 @@ Mostly we check word delimiters." | |||
| 1183 | ;* time that function is called. */ | 1145 | ;* time that function is called. */ |
| 1184 | ;*---------------------------------------------------------------------*/ | 1146 | ;*---------------------------------------------------------------------*/ |
| 1185 | (defun flyspell-math-tex-command-p () | 1147 | (defun flyspell-math-tex-command-p () |
| 1186 | (cond | 1148 | (when (fboundp 'texmathp) |
| 1187 | (flyspell-check-tex-math-command | 1149 | (cond |
| 1188 | nil) | 1150 | (flyspell-check-tex-math-command |
| 1189 | ((eq flyspell-tex-math-initialized t) | 1151 | nil) |
| 1190 | (texmathp)) | 1152 | ((eq flyspell-tex-math-initialized t) |
| 1191 | ((eq flyspell-tex-math-initialized 'error) | 1153 | (texmathp)) |
| 1192 | nil) | 1154 | ((eq flyspell-tex-math-initialized 'error) |
| 1193 | (t | 1155 | nil) |
| 1194 | (setq flyspell-tex-math-initialized t) | 1156 | (t |
| 1195 | (condition-case nil | 1157 | (setq flyspell-tex-math-initialized t) |
| 1196 | (texmathp) | 1158 | (condition-case nil |
| 1197 | (error (progn | 1159 | (texmathp) |
| 1198 | (setq flyspell-tex-math-initialized 'error) | 1160 | (error (progn |
| 1199 | nil)))))) | 1161 | (setq flyspell-tex-math-initialized 'error) |
| 1162 | nil))))))) | ||
| 1200 | 1163 | ||
| 1201 | ;*---------------------------------------------------------------------*/ | 1164 | ;*---------------------------------------------------------------------*/ |
| 1202 | ;* flyspell-tex-command-p ... */ | 1165 | ;* flyspell-tex-command-p ... */ |
| @@ -1383,9 +1346,7 @@ Word syntax described by `flyspell-dictionary-alist' (which see)." | |||
| 1383 | (let ((buffer flyspell-external-ispell-buffer)) | 1346 | (let ((buffer flyspell-external-ispell-buffer)) |
| 1384 | (set-buffer buffer) | 1347 | (set-buffer buffer) |
| 1385 | (goto-char (point-min)) | 1348 | (goto-char (point-min)) |
| 1386 | (let ((size (- flyspell-large-region-end flyspell-large-region-beg)) | 1349 | (let ((pword "") |
| 1387 | (start flyspell-large-region-beg) | ||
| 1388 | (pword "") | ||
| 1389 | (pcount 1)) | 1350 | (pcount 1)) |
| 1390 | ;; now we are done with ispell, we have to find the word in | 1351 | ;; now we are done with ispell, we have to find the word in |
| 1391 | ;; the initial buffer | 1352 | ;; the initial buffer |
| @@ -1613,7 +1574,7 @@ for the overlay." | |||
| 1613 | (overlay-put flyspell-overlay | 1574 | (overlay-put flyspell-overlay |
| 1614 | flyspell-overlay-keymap-property-name | 1575 | flyspell-overlay-keymap-property-name |
| 1615 | flyspell-mouse-map)) | 1576 | flyspell-mouse-map)) |
| 1616 | (when (eq face 'flyspell-incorrect-face) | 1577 | (when (eq face 'flyspell-incorrect) |
| 1617 | (and (stringp flyspell-before-incorrect-word-string) | 1578 | (and (stringp flyspell-before-incorrect-word-string) |
| 1618 | (overlay-put flyspell-overlay 'before-string | 1579 | (overlay-put flyspell-overlay 'before-string |
| 1619 | flyspell-before-incorrect-word-string)) | 1580 | flyspell-before-incorrect-word-string)) |
| @@ -1653,7 +1614,7 @@ for the overlay." | |||
| 1653 | ;; now we can use a new overlay | 1614 | ;; now we can use a new overlay |
| 1654 | (setq flyspell-overlay | 1615 | (setq flyspell-overlay |
| 1655 | (make-flyspell-overlay | 1616 | (make-flyspell-overlay |
| 1656 | beg end 'flyspell-incorrect-face 'highlight))))))) | 1617 | beg end 'flyspell-incorrect 'highlight))))))) |
| 1657 | 1618 | ||
| 1658 | ;*---------------------------------------------------------------------*/ | 1619 | ;*---------------------------------------------------------------------*/ |
| 1659 | ;* flyspell-highlight-duplicate-region ... */ | 1620 | ;* flyspell-highlight-duplicate-region ... */ |
| @@ -1679,7 +1640,7 @@ for the overlay." | |||
| 1679 | ;; now we can use a new overlay | 1640 | ;; now we can use a new overlay |
| 1680 | (setq flyspell-overlay | 1641 | (setq flyspell-overlay |
| 1681 | (make-flyspell-overlay beg end | 1642 | (make-flyspell-overlay beg end |
| 1682 | 'flyspell-duplicate-face | 1643 | 'flyspell-duplicate |
| 1683 | 'highlight))))))) | 1644 | 'highlight))))))) |
| 1684 | 1645 | ||
| 1685 | ;*---------------------------------------------------------------------*/ | 1646 | ;*---------------------------------------------------------------------*/ |
| @@ -1741,8 +1702,7 @@ misspelled words backwards." | |||
| 1741 | (let ((num (car pos))) | 1702 | (let ((num (car pos))) |
| 1742 | (put-text-property num | 1703 | (put-text-property num |
| 1743 | (+ num (length flyspell-auto-correct-word)) | 1704 | (+ num (length flyspell-auto-correct-word)) |
| 1744 | 'face | 1705 | 'face 'flyspell-incorrect |
| 1745 | 'flyspell-incorrect-face | ||
| 1746 | string)) | 1706 | string)) |
| 1747 | (setq pos (cdr pos))) | 1707 | (setq pos (cdr pos))) |
| 1748 | (if (fboundp 'display-message) | 1708 | (if (fboundp 'display-message) |
| @@ -1879,7 +1839,7 @@ This command proposes various successive corrections for the current word." | |||
| 1879 | (defun flyspell-auto-correct-previous-hook () | 1839 | (defun flyspell-auto-correct-previous-hook () |
| 1880 | "Hook to track successive calls to `flyspell-auto-correct-previous-word'. | 1840 | "Hook to track successive calls to `flyspell-auto-correct-previous-word'. |
| 1881 | Sets `flyspell-auto-correct-previous-pos' to nil" | 1841 | Sets `flyspell-auto-correct-previous-pos' to nil" |
| 1882 | (interactive) | 1842 | (interactive) |
| 1883 | (remove-hook 'pre-command-hook (function flyspell-auto-correct-previous-hook) t) | 1843 | (remove-hook 'pre-command-hook (function flyspell-auto-correct-previous-hook) t) |
| 1884 | (unless (eq this-command (function flyspell-auto-correct-previous-word)) | 1844 | (unless (eq this-command (function flyspell-auto-correct-previous-word)) |
| 1885 | (setq flyspell-auto-correct-previous-pos nil))) | 1845 | (setq flyspell-auto-correct-previous-pos nil))) |
| @@ -1887,7 +1847,7 @@ Sets `flyspell-auto-correct-previous-pos' to nil" | |||
| 1887 | ;*---------------------------------------------------------------------*/ | 1847 | ;*---------------------------------------------------------------------*/ |
| 1888 | ;* flyspell-auto-correct-previous-word ... */ | 1848 | ;* flyspell-auto-correct-previous-word ... */ |
| 1889 | ;*---------------------------------------------------------------------*/ | 1849 | ;*---------------------------------------------------------------------*/ |
| 1890 | (defun flyspell-auto-correct-previous-word (position) | 1850 | (defun flyspell-auto-correct-previous-word (position) |
| 1891 | "*Auto correct the first mispelled word that occurs before point. | 1851 | "*Auto correct the first mispelled word that occurs before point. |
| 1892 | But don't look beyond what's visible on the screen." | 1852 | But don't look beyond what's visible on the screen." |
| 1893 | (interactive "d") | 1853 | (interactive "d") |
| @@ -1903,29 +1863,29 @@ But don't look beyond what's visible on the screen." | |||
| 1903 | (narrow-to-region top bot) | 1863 | (narrow-to-region top bot) |
| 1904 | (overlay-recenter (point)) | 1864 | (overlay-recenter (point)) |
| 1905 | 1865 | ||
| 1906 | (add-hook 'pre-command-hook | 1866 | (add-hook 'pre-command-hook |
| 1907 | (function flyspell-auto-correct-previous-hook) t t) | 1867 | (function flyspell-auto-correct-previous-hook) t t) |
| 1908 | 1868 | ||
| 1909 | (unless flyspell-auto-correct-previous-pos | 1869 | (unless flyspell-auto-correct-previous-pos |
| 1910 | ;; only reset if a new overlay exists | 1870 | ;; only reset if a new overlay exists |
| 1911 | (setq flyspell-auto-correct-previous-pos nil) | 1871 | (setq flyspell-auto-correct-previous-pos nil) |
| 1912 | 1872 | ||
| 1913 | (let ((overlay-list (overlays-in (point-min) position)) | 1873 | (let ((overlay-list (overlays-in (point-min) position)) |
| 1914 | (new-overlay 'dummy-value)) | 1874 | (new-overlay 'dummy-value)) |
| 1915 | 1875 | ||
| 1916 | ;; search for previous (new) flyspell overlay | 1876 | ;; search for previous (new) flyspell overlay |
| 1917 | (while (and new-overlay | 1877 | (while (and new-overlay |
| 1918 | (or (not (flyspell-overlay-p new-overlay)) | 1878 | (or (not (flyspell-overlay-p new-overlay)) |
| 1919 | ;; check if its face has changed | 1879 | ;; check if its face has changed |
| 1920 | (not (eq (get-char-property | 1880 | (not (eq (get-char-property |
| 1921 | (overlay-start new-overlay) 'face) | 1881 | (overlay-start new-overlay) 'face) |
| 1922 | 'flyspell-incorrect-face)))) | 1882 | 'flyspell-incorrect)))) |
| 1923 | (setq new-overlay (car-safe overlay-list)) | 1883 | (setq new-overlay (car-safe overlay-list)) |
| 1924 | (setq overlay-list (cdr-safe overlay-list))) | 1884 | (setq overlay-list (cdr-safe overlay-list))) |
| 1925 | 1885 | ||
| 1926 | ;; if nothing new exits new-overlay should be nil | 1886 | ;; if nothing new exits new-overlay should be nil |
| 1927 | (if new-overlay ;; the length of the word may change so go to the start | 1887 | (if new-overlay ;; the length of the word may change so go to the start |
| 1928 | (setq flyspell-auto-correct-previous-pos | 1888 | (setq flyspell-auto-correct-previous-pos |
| 1929 | (overlay-start new-overlay))))) | 1889 | (overlay-start new-overlay))))) |
| 1930 | 1890 | ||
| 1931 | (when flyspell-auto-correct-previous-pos | 1891 | (when flyspell-auto-correct-previous-pos |
| @@ -1956,7 +1916,7 @@ The word checked is the word at the mouse position." | |||
| 1956 | (let ((start (car (cdr word))) | 1916 | (let ((start (car (cdr word))) |
| 1957 | (end (car (cdr (cdr word)))) | 1917 | (end (car (cdr (cdr word)))) |
| 1958 | (word (car word)) | 1918 | (word (car word)) |
| 1959 | poss replace) | 1919 | poss) |
| 1960 | ;; now check spelling of word. | 1920 | ;; now check spelling of word. |
| 1961 | (process-send-string ispell-process "%\n") ;put in verbose mode | 1921 | (process-send-string ispell-process "%\n") ;put in verbose mode |
| 1962 | (process-send-string ispell-process (concat "^" word "\n")) | 1922 | (process-send-string ispell-process (concat "^" word "\n")) |
| @@ -1974,89 +1934,65 @@ The word checked is the word at the mouse position." | |||
| 1974 | ((null poss) | 1934 | ((null poss) |
| 1975 | ;; ispell error | 1935 | ;; ispell error |
| 1976 | (error "Ispell: error in Ispell process")) | 1936 | (error "Ispell: error in Ispell process")) |
| 1977 | ((string-match "GNU" (emacs-version)) | 1937 | ((featurep 'xemacs) |
| 1978 | ;; the word is incorrect, we have to propose a replacement | ||
| 1979 | (setq replace (flyspell-emacs-popup event poss word)) | ||
| 1980 | (cond ((eq replace 'ignore) | ||
| 1981 | (goto-char save) | ||
| 1982 | nil) | ||
| 1983 | ((eq replace 'save) | ||
| 1984 | (goto-char save) | ||
| 1985 | (process-send-string ispell-process | ||
| 1986 | (concat "*" word "\n")) | ||
| 1987 | (flyspell-unhighlight-at cursor-location) | ||
| 1988 | (setq ispell-pdict-modified-p '(t))) | ||
| 1989 | ((or (eq replace 'buffer) (eq replace 'session)) | ||
| 1990 | (process-send-string ispell-process | ||
| 1991 | (concat "@" word "\n")) | ||
| 1992 | (if (null ispell-pdict-modified-p) | ||
| 1993 | (setq ispell-pdict-modified-p | ||
| 1994 | (list ispell-pdict-modified-p))) | ||
| 1995 | (flyspell-unhighlight-at cursor-location) | ||
| 1996 | (goto-char save) | ||
| 1997 | (if (eq replace 'buffer) | ||
| 1998 | (ispell-add-per-file-word-list word))) | ||
| 1999 | (replace | ||
| 2000 | (flyspell-unhighlight-at cursor-location) | ||
| 2001 | (let ((new-word (if (atom replace) | ||
| 2002 | replace | ||
| 2003 | (car replace))) | ||
| 2004 | (cursor-location | ||
| 2005 | (+ (- (length word) (- end start)) | ||
| 2006 | cursor-location))) | ||
| 2007 | (if (not (equal new-word (car poss))) | ||
| 2008 | (let ((old-max (point-max))) | ||
| 2009 | (delete-region start end) | ||
| 2010 | (funcall flyspell-insert-function new-word) | ||
| 2011 | (if flyspell-abbrev-p | ||
| 2012 | (flyspell-define-abbrev word new-word)) | ||
| 2013 | (flyspell-ajust-cursor-point save | ||
| 2014 | cursor-location | ||
| 2015 | old-max))))) | ||
| 2016 | (t | ||
| 2017 | (goto-char save) | ||
| 2018 | nil))) | ||
| 2019 | ((eq flyspell-emacs 'xemacs) | ||
| 2020 | (flyspell-xemacs-popup | 1938 | (flyspell-xemacs-popup |
| 2021 | event poss word cursor-location start end save) | 1939 | event poss word cursor-location start end save)) |
| 2022 | (goto-char save))) | 1940 | (t |
| 1941 | ;; The word is incorrect, we have to propose a replacement. | ||
| 1942 | (flyspell-do-correct (flyspell-emacs-popup event poss word) | ||
| 1943 | poss word cursor-location start end save))) | ||
| 2023 | (ispell-pdict-save t)))))) | 1944 | (ispell-pdict-save t)))))) |
| 2024 | 1945 | ||
| 2025 | ;*---------------------------------------------------------------------*/ | 1946 | ;*---------------------------------------------------------------------*/ |
| 2026 | ;* flyspell-xemacs-correct ... */ | 1947 | ;* flyspell-do-correct ... */ |
| 2027 | ;*---------------------------------------------------------------------*/ | 1948 | ;*---------------------------------------------------------------------*/ |
| 2028 | (defun flyspell-xemacs-correct (replace poss word cursor-location start end save) | 1949 | (defun flyspell-do-correct (replace poss word cursor-location start end save) |
| 2029 | "The xemacs popup menu callback." | 1950 | "The popup menu callback." |
| 1951 | ;; Originally, the XEmacs code didn't do the (goto-char save) here and did | ||
| 1952 | ;; it instead right after calling the function. | ||
| 2030 | (cond ((eq replace 'ignore) | 1953 | (cond ((eq replace 'ignore) |
| 1954 | (goto-char save) | ||
| 2031 | nil) | 1955 | nil) |
| 2032 | ((eq replace 'save) | 1956 | ((eq replace 'save) |
| 2033 | (process-send-string ispell-process (concat "*" word "\n")) | 1957 | (goto-char save) |
| 2034 | (process-send-string ispell-process "#\n") | 1958 | (ispell-send-string (concat "*" word "\n")) |
| 1959 | ;; This was added only to the XEmacs side in revision 1.18 of | ||
| 1960 | ;; flyspell. I assume its absence on the Emacs side was an | ||
| 1961 | ;; oversight. --Stef | ||
| 1962 | (ispell-send-string "#\n") | ||
| 2035 | (flyspell-unhighlight-at cursor-location) | 1963 | (flyspell-unhighlight-at cursor-location) |
| 2036 | (setq ispell-pdict-modified-p '(t))) | 1964 | (setq ispell-pdict-modified-p '(t))) |
| 2037 | ((or (eq replace 'buffer) (eq replace 'session)) | 1965 | ((or (eq replace 'buffer) (eq replace 'session)) |
| 2038 | (process-send-string ispell-process (concat "@" word "\n")) | 1966 | (ispell-send-string (concat "@" word "\n")) |
| 2039 | (flyspell-unhighlight-at cursor-location) | 1967 | (flyspell-unhighlight-at cursor-location) |
| 2040 | (if (null ispell-pdict-modified-p) | 1968 | (if (null ispell-pdict-modified-p) |
| 2041 | (setq ispell-pdict-modified-p | 1969 | (setq ispell-pdict-modified-p |
| 2042 | (list ispell-pdict-modified-p))) | 1970 | (list ispell-pdict-modified-p))) |
| 1971 | (goto-char save) | ||
| 2043 | (if (eq replace 'buffer) | 1972 | (if (eq replace 'buffer) |
| 2044 | (ispell-add-per-file-word-list word))) | 1973 | (ispell-add-per-file-word-list word))) |
| 2045 | (replace | 1974 | (replace |
| 1975 | ;; This was added only to the Emacs side. I assume its absence on | ||
| 1976 | ;; the XEmacs side was an oversight. --Stef | ||
| 1977 | (flyspell-unhighlight-at cursor-location) | ||
| 2046 | (let ((old-max (point-max)) | 1978 | (let ((old-max (point-max)) |
| 2047 | (new-word (if (atom replace) | 1979 | (new-word (if (atom replace) |
| 2048 | replace | 1980 | replace |
| 2049 | (car replace))) | 1981 | (car replace))) |
| 2050 | (cursor-location (+ (- (length word) (- end start)) | 1982 | (cursor-location (+ (- (length word) (- end start)) |
| 2051 | cursor-location))) | 1983 | cursor-location))) |
| 2052 | (if (not (equal new-word (car poss))) | 1984 | (unless (equal new-word (car poss)) |
| 2053 | (progn | 1985 | (delete-region start end) |
| 2054 | (delete-region start end) | 1986 | (goto-char start) |
| 2055 | (goto-char start) | 1987 | (funcall flyspell-insert-function new-word) |
| 2056 | (funcall flyspell-insert-function new-word) | 1988 | (if flyspell-abbrev-p |
| 2057 | (if flyspell-abbrev-p | 1989 | (flyspell-define-abbrev word new-word))) |
| 2058 | (flyspell-define-abbrev word new-word)))) | 1990 | ;; In the original Emacs code, this was only called in the body |
| 2059 | (flyspell-ajust-cursor-point save cursor-location old-max))))) | 1991 | ;; of the if. I arbitrarily kept the XEmacs behavior instead. |
| 1992 | (flyspell-ajust-cursor-point save cursor-location old-max))) | ||
| 1993 | (t | ||
| 1994 | (goto-char save) | ||
| 1995 | nil))) | ||
| 2060 | 1996 | ||
| 2061 | ;*---------------------------------------------------------------------*/ | 1997 | ;*---------------------------------------------------------------------*/ |
| 2062 | ;* flyspell-ajust-cursor-point ... */ | 1998 | ;* flyspell-ajust-cursor-point ... */ |
| @@ -2125,7 +2061,7 @@ The word checked is the word at the mouse position." | |||
| 2125 | (cor-menu (if (consp corrects) | 2061 | (cor-menu (if (consp corrects) |
| 2126 | (mapcar (lambda (correct) | 2062 | (mapcar (lambda (correct) |
| 2127 | (vector correct | 2063 | (vector correct |
| 2128 | (list 'flyspell-xemacs-correct | 2064 | (list 'flyspell-do-correct |
| 2129 | correct | 2065 | correct |
| 2130 | (list 'quote poss) | 2066 | (list 'quote poss) |
| 2131 | word | 2067 | word |
| @@ -2140,7 +2076,7 @@ The word checked is the word at the mouse position." | |||
| 2140 | (menu (let ((save (if (consp affix) | 2076 | (menu (let ((save (if (consp affix) |
| 2141 | (vector | 2077 | (vector |
| 2142 | (concat "Save affix: " (car affix)) | 2078 | (concat "Save affix: " (car affix)) |
| 2143 | (list 'flyspell-xemacs-correct | 2079 | (list 'flyspell-do-correct |
| 2144 | ''save | 2080 | ''save |
| 2145 | (list 'quote poss) | 2081 | (list 'quote poss) |
| 2146 | word | 2082 | word |
| @@ -2151,7 +2087,7 @@ The word checked is the word at the mouse position." | |||
| 2151 | t) | 2087 | t) |
| 2152 | (vector | 2088 | (vector |
| 2153 | "Save word" | 2089 | "Save word" |
| 2154 | (list 'flyspell-xemacs-correct | 2090 | (list 'flyspell-do-correct |
| 2155 | ''save | 2091 | ''save |
| 2156 | (list 'quote poss) | 2092 | (list 'quote poss) |
| 2157 | word | 2093 | word |
| @@ -2161,7 +2097,7 @@ The word checked is the word at the mouse position." | |||
| 2161 | save) | 2097 | save) |
| 2162 | t))) | 2098 | t))) |
| 2163 | (session (vector "Accept (session)" | 2099 | (session (vector "Accept (session)" |
| 2164 | (list 'flyspell-xemacs-correct | 2100 | (list 'flyspell-do-correct |
| 2165 | ''session | 2101 | ''session |
| 2166 | (list 'quote poss) | 2102 | (list 'quote poss) |
| 2167 | word | 2103 | word |
| @@ -2171,7 +2107,7 @@ The word checked is the word at the mouse position." | |||
| 2171 | save) | 2107 | save) |
| 2172 | t)) | 2108 | t)) |
| 2173 | (buffer (vector "Accept (buffer)" | 2109 | (buffer (vector "Accept (buffer)" |
| 2174 | (list 'flyspell-xemacs-correct | 2110 | (list 'flyspell-do-correct |
| 2175 | ''buffer | 2111 | ''buffer |
| 2176 | (list 'quote poss) | 2112 | (list 'quote poss) |
| 2177 | word | 2113 | word |
| @@ -2198,9 +2134,9 @@ Ispell, after transposing two adjacent characters, correct the text, | |||
| 2198 | and return t. | 2134 | and return t. |
| 2199 | 2135 | ||
| 2200 | The third arg POSS is either the symbol 'doublon' or a list of | 2136 | The third arg POSS is either the symbol 'doublon' or a list of |
| 2201 | possible corrections as returned by 'ispell-parse-output'. | 2137 | possible corrections as returned by `ispell-parse-output'. |
| 2202 | 2138 | ||
| 2203 | This function is meant to be added to 'flyspell-incorrect-hook'." | 2139 | This function is meant to be added to `flyspell-incorrect-hook'." |
| 2204 | (when (consp poss) | 2140 | (when (consp poss) |
| 2205 | (catch 'done | 2141 | (catch 'done |
| 2206 | (let ((str (buffer-substring beg end)) | 2142 | (let ((str (buffer-substring beg end)) |
| @@ -2228,9 +2164,9 @@ Ispell, after removing a pair of doubled characters, correct the text, | |||
| 2228 | and return t. | 2164 | and return t. |
| 2229 | 2165 | ||
| 2230 | The third arg POSS is either the symbol 'doublon' or a list of | 2166 | The third arg POSS is either the symbol 'doublon' or a list of |
| 2231 | possible corrections as returned by 'ispell-parse-output'. | 2167 | possible corrections as returned by `ispell-parse-output'. |
| 2232 | 2168 | ||
| 2233 | This function is meant to be added to 'flyspell-incorrect-hook'." | 2169 | This function is meant to be added to `flyspell-incorrect-hook'." |
| 2234 | (when (consp poss) | 2170 | (when (consp poss) |
| 2235 | (catch 'done | 2171 | (catch 'done |
| 2236 | (let ((str (buffer-substring beg end)) | 2172 | (let ((str (buffer-substring beg end)) |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 1de27265b08..afdfc951b96 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -796,19 +796,16 @@ Otherwise returns the library directory name, if that is defined." | |||
| 796 | nil t) | 796 | nil t) |
| 797 | case-fold-search case-fold-search-val) | 797 | case-fold-search case-fold-search-val) |
| 798 | (if (or (not status) ; major version mismatch | 798 | (if (or (not status) ; major version mismatch |
| 799 | (< (car (read-from-string (buffer-substring-no-properties | 799 | (< (car (read-from-string (match-string-no-properties 2))) |
| 800 | (match-beginning 2) (match-end 2)))) | ||
| 801 | (car (cdr ispell-required-version)))) ; minor version mismatch | 800 | (car (cdr ispell-required-version)))) ; minor version mismatch |
| 802 | (error "%s version 3 release %d.%d.%d or greater is required" | 801 | (error "%s version 3 release %d.%d.%d or greater is required" |
| 803 | ispell-program-name (car ispell-required-version) | 802 | ispell-program-name (car ispell-required-version) |
| 804 | (car (cdr ispell-required-version)) | 803 | (car (cdr ispell-required-version)) |
| 805 | (car (cdr (cdr ispell-required-version)))) | 804 | (car (cdr (cdr ispell-required-version)))) |
| 806 | ;; check that it is the correct version. | 805 | ;; check that it is the correct version. |
| 807 | (if (and (= (car (read-from-string (buffer-substring-no-properties | 806 | (if (and (= (car (read-from-string (match-string-no-properties 2))) |
| 808 | (match-beginning 2)(match-end 2)))) | ||
| 809 | (car (cdr ispell-required-version))) | 807 | (car (cdr ispell-required-version))) |
| 810 | (< (car (read-from-string (buffer-substring-no-properties | 808 | (< (car (read-from-string (match-string-no-properties 3))) |
| 811 | (match-beginning 3)(match-end 3)))) | ||
| 812 | (car (cdr (cdr ispell-required-version))))) | 809 | (car (cdr (cdr ispell-required-version))))) |
| 813 | (setq ispell-offset 0)) | 810 | (setq ispell-offset 0)) |
| 814 | ;; Check to see if it's really aspell. | 811 | ;; Check to see if it's really aspell. |
| @@ -945,7 +942,7 @@ The variable `ispell-library-directory' defines the library location." | |||
| 945 | '(menu-item "Automatic spell checking (Flyspell)" | 942 | '(menu-item "Automatic spell checking (Flyspell)" |
| 946 | flyspell-mode | 943 | flyspell-mode |
| 947 | :help "Check spelling while you edit the text" | 944 | :help "Check spelling while you edit the text" |
| 948 | :button (:toggle . flyspell-mode))) | 945 | :button (:toggle . (bound-and-true-p flyspell-mode)))) |
| 949 | (define-key ispell-menu-map [ispell-complete-word] | 946 | (define-key ispell-menu-map [ispell-complete-word] |
| 950 | '(menu-item "Complete Word" ispell-complete-word | 947 | '(menu-item "Complete Word" ispell-complete-word |
| 951 | :help "Complete word at cursor using dictionary")) | 948 | :help "Complete word at cursor using dictionary")) |
| @@ -2567,9 +2564,7 @@ Return nil if spell session is quit, | |||
| 2567 | (ispell-begin-skip-region-regexp) | 2564 | (ispell-begin-skip-region-regexp) |
| 2568 | ispell-region-end t)) | 2565 | ispell-region-end t)) |
| 2569 | (progn | 2566 | (progn |
| 2570 | (setq key (buffer-substring-no-properties | 2567 | (setq key (match-string-no-properties 0)) |
| 2571 | (car (match-data)) | ||
| 2572 | (car (cdr (match-data))))) | ||
| 2573 | (set-marker skip-region-start | 2568 | (set-marker skip-region-start |
| 2574 | (- (point) (length key))) | 2569 | (- (point) (length key))) |
| 2575 | (goto-char rstart)) | 2570 | (goto-char rstart)) |
| @@ -3510,8 +3505,7 @@ Includes Latex/Nroff modes and extended character mode." | |||
| 3510 | (search-forward ispell-parsing-keyword) | 3505 | (search-forward ispell-parsing-keyword) |
| 3511 | (while (re-search-forward " *\\([^ \"]+\\)" end t) | 3506 | (while (re-search-forward " *\\([^ \"]+\\)" end t) |
| 3512 | ;; space separated definitions. | 3507 | ;; space separated definitions. |
| 3513 | (setq string (downcase (buffer-substring-no-properties | 3508 | (setq string (downcase (match-string-no-properties 1))) |
| 3514 | (match-beginning 1) (match-end 1)))) | ||
| 3515 | (cond ((and (string-match "latex-mode" string) | 3509 | (cond ((and (string-match "latex-mode" string) |
| 3516 | (not (eq 'exclusive ispell-check-comments))) | 3510 | (not (eq 'exclusive ispell-check-comments))) |
| 3517 | (ispell-send-string "+\n~tex\n")) | 3511 | (ispell-send-string "+\n~tex\n")) |
| @@ -3544,8 +3538,7 @@ Both should not be used to define a buffer-local dictionary." | |||
| 3544 | (setq end (save-excursion (end-of-line) (point))) | 3538 | (setq end (save-excursion (end-of-line) (point))) |
| 3545 | (if (re-search-forward " *\\([^ \"]+\\)" end t) | 3539 | (if (re-search-forward " *\\([^ \"]+\\)" end t) |
| 3546 | (setq ispell-local-dictionary | 3540 | (setq ispell-local-dictionary |
| 3547 | (buffer-substring-no-properties (match-beginning 1) | 3541 | (match-string-no-properties 1)))))) |
| 3548 | (match-end 1))))))) | ||
| 3549 | (goto-char (point-max)) | 3542 | (goto-char (point-max)) |
| 3550 | (if (search-backward ispell-pdict-keyword nil t) | 3543 | (if (search-backward ispell-pdict-keyword nil t) |
| 3551 | (progn | 3544 | (progn |
| @@ -3553,8 +3546,7 @@ Both should not be used to define a buffer-local dictionary." | |||
| 3553 | (setq end (save-excursion (end-of-line) (point))) | 3546 | (setq end (save-excursion (end-of-line) (point))) |
| 3554 | (if (re-search-forward " *\\([^ \"]+\\)" end t) | 3547 | (if (re-search-forward " *\\([^ \"]+\\)" end t) |
| 3555 | (setq ispell-local-pdict | 3548 | (setq ispell-local-pdict |
| 3556 | (buffer-substring-no-properties (match-beginning 1) | 3549 | (match-string-no-properties 1))))))) |
| 3557 | (match-end 1)))))))) | ||
| 3558 | ;; Reload if new personal dictionary defined. | 3550 | ;; Reload if new personal dictionary defined. |
| 3559 | (if (and ispell-local-pdict | 3551 | (if (and ispell-local-pdict |
| 3560 | (not (equal ispell-local-pdict ispell-personal-dictionary))) | 3552 | (not (equal ispell-local-pdict ispell-personal-dictionary))) |
| @@ -3584,8 +3576,7 @@ Both should not be used to define a buffer-local dictionary." | |||
| 3584 | ;; buffer-local words separated by a space, and can contain | 3576 | ;; buffer-local words separated by a space, and can contain |
| 3585 | ;; any character other than a space. Not rigorous enough. | 3577 | ;; any character other than a space. Not rigorous enough. |
| 3586 | (while (re-search-forward " *\\([^ ]+\\)" end t) | 3578 | (while (re-search-forward " *\\([^ ]+\\)" end t) |
| 3587 | (setq string (buffer-substring-no-properties (match-beginning 1) | 3579 | (setq string (match-string-no-properties 1)) |
| 3588 | (match-end 1))) | ||
| 3589 | ;; This can fail when string contains a word with illegal chars. | 3580 | ;; This can fail when string contains a word with illegal chars. |
| 3590 | ;; Error handling needs to be added between ispell and emacs. | 3581 | ;; Error handling needs to be added between ispell and emacs. |
| 3591 | (if (and (< 1 (length string)) | 3582 | (if (and (< 1 (length string)) |
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index bbc59768aaf..635bb6b5a98 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | ;; org.el --- Outline-based notes management and organizer | 1 | ;;; org.el --- Outline-based notes management and organizer |
| 2 | ;; Carstens outline-mode for keeping track of everything. | 2 | ;; Carstens outline-mode for keeping track of everything. |
| 3 | ;; Copyright (c) 2004, 2005 Free Software Foundation | 3 | ;; Copyright (c) 2004, 2005 Free Software Foundation |
| 4 | ;; | 4 | ;; |
| 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 | 6 | ;; Keywords: outlines, hypermedia, calendar |
| 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
| 8 | ;; Version: 3.10 | 8 | ;; Version: 3.11 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -80,6 +80,17 @@ | |||
| 80 | ;; | 80 | ;; |
| 81 | ;; Changes: | 81 | ;; Changes: |
| 82 | ;; ------- | 82 | ;; ------- |
| 83 | ;; Version 3.11 | ||
| 84 | ;; - Links inserted with C-c C-l are now by default enclosed in angle | ||
| 85 | ;; brackets. See the new variable `org-link-format'. | ||
| 86 | ;; - ">" terminates a link, this is a way to have several links in a line. | ||
| 87 | ;; - Archiving of finished tasks. | ||
| 88 | ;; - C-<up>/<down> bindings removed, to allow access to paragraph commands. | ||
| 89 | ;; - Compatibility with CUA-mode (see variable `org-CUA-compatible'). | ||
| 90 | ;; - Compatibility problems with viper-mode fixed. | ||
| 91 | ;; - Improved html export of tables. | ||
| 92 | ;; - Various clean-up changes. | ||
| 93 | ;; | ||
| 83 | ;; Version 3.10 | 94 | ;; Version 3.10 |
| 84 | ;; - Using `define-derived-mode' to derive `org-mode' from `outline-mode'. | 95 | ;; - Using `define-derived-mode' to derive `org-mode' from `outline-mode'. |
| 85 | ;; | 96 | ;; |
| @@ -154,12 +165,10 @@ | |||
| 154 | (require 'outline) | 165 | (require 'outline) |
| 155 | (require 'time-date) | 166 | (require 'time-date) |
| 156 | (require 'easymenu) | 167 | (require 'easymenu) |
| 157 | (or (fboundp 'run-mode-hooks) | ||
| 158 | (defalias 'run-mode-hooks 'run-hooks)) | ||
| 159 | 168 | ||
| 160 | ;;; Customization variables | 169 | ;;; Customization variables |
| 161 | 170 | ||
| 162 | (defvar org-version "3.10" | 171 | (defvar org-version "3.11" |
| 163 | "The version number of the file org.el.") | 172 | "The version number of the file org.el.") |
| 164 | (defun org-version () | 173 | (defun org-version () |
| 165 | (interactive) | 174 | (interactive) |
| @@ -185,6 +194,44 @@ | |||
| 185 | :tag "Org Startup" | 194 | :tag "Org Startup" |
| 186 | :group 'org) | 195 | :group 'org) |
| 187 | 196 | ||
| 197 | (defcustom org-CUA-compatible nil | ||
| 198 | "Non-nil means use alternative key bindings for S-<cursor movement>. | ||
| 199 | Org-mode used S-<cursor movement> for changing timestamps and priorities. | ||
| 200 | S-<cursor movement> is also used for example by `CUA-mode' to select text. | ||
| 201 | If you want to use Org-mode together with `CUA-mode', Org-mode needs to use | ||
| 202 | alternative bindings. Setting this variable to t will replace the following | ||
| 203 | keys both in Org-mode and in the Org-agenda buffer. | ||
| 204 | |||
| 205 | S-RET -> C-S-RET | ||
| 206 | S-up -> M-p | ||
| 207 | S-down -> M-n | ||
| 208 | S-left -> M-- | ||
| 209 | S-right -> M-+ | ||
| 210 | |||
| 211 | If you do not like the alternative keys, take a look at the variable | ||
| 212 | `org-disputed-keys'. | ||
| 213 | |||
| 214 | This option is only relevant at load-time of Org-mode. Changing it requires | ||
| 215 | a restart of Emacs to become effective." | ||
| 216 | :group 'org-startup | ||
| 217 | :type 'boolean) | ||
| 218 | |||
| 219 | (defvar org-disputed-keys | ||
| 220 | '((S-up [(shift up)] [(meta ?p)]) | ||
| 221 | (S-down [(shift down)] [(meta ?n)]) | ||
| 222 | (S-left [(shift left)] [(meta ?-)]) | ||
| 223 | (S-right [(shift right)] [(meta ?+)]) | ||
| 224 | (S-return [(shift return)] [(control shift return)])) | ||
| 225 | "Keys for which Org-mode and other modes compete. | ||
| 226 | This is an alist, cars are symbols for lookup, 1st element is the default key, | ||
| 227 | second element will be used when `org-CUA-compatible' is t.") | ||
| 228 | |||
| 229 | (defun org-key (key) | ||
| 230 | "Select a key according to `org-CUA-compatible'." | ||
| 231 | (nth (if org-CUA-compatible 2 1) | ||
| 232 | (or (assq key org-disputed-keys) | ||
| 233 | (error "Invalid Key %s in `org-key'" key)))) | ||
| 234 | |||
| 188 | (defcustom org-startup-folded t | 235 | (defcustom org-startup-folded t |
| 189 | "Non-nil means, entering Org-mode will switch to OVERVIEW. | 236 | "Non-nil means, entering Org-mode will switch to OVERVIEW. |
| 190 | This can also be configured on a per-file basis by adding one of | 237 | This can also be configured on a per-file basis by adding one of |
| @@ -388,16 +435,17 @@ is used instead.") | |||
| 388 | "Precompute regular expressions for current buffer." | 435 | "Precompute regular expressions for current buffer." |
| 389 | (when (eq major-mode 'org-mode) | 436 | (when (eq major-mode 'org-mode) |
| 390 | (let ((re (org-make-options-regexp | 437 | (let ((re (org-make-options-regexp |
| 391 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP"))) | 438 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" |
| 439 | "STARTUP" "ARCHIVE"))) | ||
| 392 | (splitre "[ \t]+") | 440 | (splitre "[ \t]+") |
| 393 | kwds int key value cat) | 441 | kwds int key value cat arch) |
| 394 | (save-excursion | 442 | (save-excursion |
| 395 | (save-restriction | 443 | (save-restriction |
| 396 | (widen) | 444 | (widen) |
| 397 | (goto-char (point-min)) | 445 | (goto-char (point-min)) |
| 398 | (while (re-search-forward re nil t) | 446 | (while (re-search-forward re nil t) |
| 399 | (setq key (match-string 1) value (match-string 2)) | 447 | (setq key (match-string 1) value (match-string 2)) |
| 400 | (cond | 448 | (cond |
| 401 | ((equal key "CATEGORY") | 449 | ((equal key "CATEGORY") |
| 402 | (if (string-match "[ \t]+$" value) | 450 | (if (string-match "[ \t]+$" value) |
| 403 | (setq value (replace-match "" t t value))) | 451 | (setq value (replace-match "" t t value))) |
| @@ -421,17 +469,23 @@ is used instead.") | |||
| 421 | l var val) | 469 | l var val) |
| 422 | (while (setq l (assoc (pop opts) set)) | 470 | (while (setq l (assoc (pop opts) set)) |
| 423 | (setq var (nth 1 l) val (nth 2 l)) | 471 | (setq var (nth 1 l) val (nth 2 l)) |
| 424 | (set (make-local-variable var) val))))) | 472 | (set (make-local-variable var) val)))) |
| 473 | ((equal key "ARCHIVE") | ||
| 474 | (string-match " *$" value) | ||
| 475 | (setq arch (replace-match "" t t value)) | ||
| 476 | (remove-text-properties 0 (length arch) | ||
| 477 | '(face t fontified t) arch))) | ||
| 425 | ))) | 478 | ))) |
| 426 | (and cat (set (make-local-variable 'org-category) cat)) | 479 | (and cat (set (make-local-variable 'org-category) cat)) |
| 427 | (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) | 480 | (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) |
| 481 | (and arch (set (make-local-variable 'org-archive-location) arch)) | ||
| 428 | (and int (set (make-local-variable 'org-todo-interpretation) int))) | 482 | (and int (set (make-local-variable 'org-todo-interpretation) int))) |
| 429 | ;; Compute the regular expressions and other local variables | 483 | ;; Compute the regular expressions and other local variables |
| 430 | (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority) | 484 | (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority) |
| 431 | org-todo-kwd-max-priority (1- (length org-todo-keywords)) | 485 | org-todo-kwd-max-priority (1- (length org-todo-keywords)) |
| 432 | org-ds-keyword-length (+ 2 (max (length org-deadline-string) | 486 | org-ds-keyword-length (+ 2 (max (length org-deadline-string) |
| 433 | (length org-scheduled-string))) | 487 | (length org-scheduled-string))) |
| 434 | org-done-string | 488 | org-done-string |
| 435 | (nth (1- (length org-todo-keywords)) org-todo-keywords) | 489 | (nth (1- (length org-todo-keywords)) org-todo-keywords) |
| 436 | org-todo-regexp | 490 | org-todo-regexp |
| 437 | (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords | 491 | (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords |
| @@ -465,6 +519,11 @@ is used instead.") | |||
| 465 | :tag "Org Time" | 519 | :tag "Org Time" |
| 466 | :group 'org) | 520 | :group 'org) |
| 467 | 521 | ||
| 522 | (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") | ||
| 523 | "Formats for `format-time-string' which are used for time stamps. | ||
| 524 | It is not recommended to change this constant.") | ||
| 525 | |||
| 526 | |||
| 468 | (defcustom org-deadline-warning-days 30 | 527 | (defcustom org-deadline-warning-days 30 |
| 469 | "No. of days before expiration during which a deadline becomes active. | 528 | "No. of days before expiration during which a deadline becomes active. |
| 470 | This variable governs the display in the org file." | 529 | This variable governs the display in the org file." |
| @@ -506,7 +565,7 @@ When nil, cursor will remain in the current window." | |||
| 506 | 565 | ||
| 507 | (defcustom org-select-agenda-window t | 566 | (defcustom org-select-agenda-window t |
| 508 | "Non-nil means, after creating an agenda, move cursor into Agenda window. | 567 | "Non-nil means, after creating an agenda, move cursor into Agenda window. |
| 509 | When nil, cursor will remain in the current window." | 568 | When nil, cursor will remain in the current window." |
| 510 | :group 'org-agenda | 569 | :group 'org-agenda |
| 511 | :type 'boolean) | 570 | :type 'boolean) |
| 512 | 571 | ||
| @@ -542,7 +601,7 @@ When nil, always start on the current day." | |||
| 542 | When nil, date-less entries will only be shown if `org-agenda' is called | 601 | When nil, date-less entries will only be shown if `org-agenda' is called |
| 543 | with a prefix argument. | 602 | with a prefix argument. |
| 544 | When non-nil, the TODO entries will be listed at the top of the agenda, before | 603 | When non-nil, the TODO entries will be listed at the top of the agenda, before |
| 545 | the entries for specific days." | 604 | the entries for specific days." |
| 546 | :group 'org-agenda | 605 | :group 'org-agenda |
| 547 | :type 'boolean) | 606 | :type 'boolean) |
| 548 | 607 | ||
| @@ -587,7 +646,7 @@ priority. | |||
| 587 | Leaving out `category-keep' would mean that items will be sorted across | 646 | Leaving out `category-keep' would mean that items will be sorted across |
| 588 | categories by priority." | 647 | categories by priority." |
| 589 | :group 'org-agenda | 648 | :group 'org-agenda |
| 590 | :type '(repeat | 649 | :type '(repeat |
| 591 | (choice | 650 | (choice |
| 592 | (const time-up) | 651 | (const time-up) |
| 593 | (const time-down) | 652 | (const time-down) |
| @@ -663,14 +722,26 @@ the variable `org-agenda-time-grid'." | |||
| 663 | :group 'org-agenda | 722 | :group 'org-agenda |
| 664 | :type 'boolean) | 723 | :type 'boolean) |
| 665 | 724 | ||
| 666 | (defcustom org-agenda-time-grid | 725 | (defcustom org-agenda-time-grid |
| 667 | '((daily today require-timed) | 726 | '((daily today require-timed) |
| 668 | "----------------" | 727 | "----------------" |
| 669 | (800 1000 1200 1400 1600 1800 2000)) | 728 | (800 1000 1200 1400 1600 1800 2000)) |
| 670 | 729 | ||
| 671 | "FIXME: document" | 730 | "The settings for time grid for agenda display. |
| 731 | This is a list of three items. The first item is again a list. It contains | ||
| 732 | symbols specifying conditions when the grid should be displayed: | ||
| 733 | |||
| 734 | daily if the agenda shows a single day | ||
| 735 | weekly if the agenda shows an entire week | ||
| 736 | today show grid on current date, independent of daily/weekly display | ||
| 737 | require-timed show grid only if at least on item has a time specification | ||
| 738 | |||
| 739 | The second item is a string which will be places behing the grid time. | ||
| 740 | |||
| 741 | The third item is a list of integers, indicating the times that should have | ||
| 742 | a grid line." | ||
| 672 | :group 'org-agenda | 743 | :group 'org-agenda |
| 673 | :type | 744 | :type |
| 674 | '(list | 745 | '(list |
| 675 | (set :greedy t :tag "Grid Display Options" | 746 | (set :greedy t :tag "Grid Display Options" |
| 676 | (const :tag "Show grid in single day agenda display" daily) | 747 | (const :tag "Show grid in single day agenda display" daily) |
| @@ -752,10 +823,6 @@ t Everywhere except in headlines" | |||
| 752 | (const :tag "Everywhere except in headlines" t) | 823 | (const :tag "Everywhere except in headlines" t) |
| 753 | )) | 824 | )) |
| 754 | 825 | ||
| 755 | (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") | ||
| 756 | "Formats for `format-time-string' which are used for time stamps. | ||
| 757 | It is not recommended to change this constant.") | ||
| 758 | |||
| 759 | (defcustom org-show-following-heading t | 826 | (defcustom org-show-following-heading t |
| 760 | "Non-nil means, show heading following match in `org-occur'. | 827 | "Non-nil means, show heading following match in `org-occur'. |
| 761 | When doing an `org-occur' it is useful to show the headline which | 828 | When doing an `org-occur' it is useful to show the headline which |
| @@ -766,12 +833,73 @@ unnecessary clutter." | |||
| 766 | :group 'org-structure | 833 | :group 'org-structure |
| 767 | :type 'boolean) | 834 | :type 'boolean) |
| 768 | 835 | ||
| 836 | (defcustom org-archive-location "%s_archive::" | ||
| 837 | "The location where subtrees should be archived. | ||
| 838 | This string consists of two parts, separated by a double-colon. | ||
| 839 | |||
| 840 | The first part is a file name - when omitted, archiving happens in the same | ||
| 841 | file. %s will be replaced by the current file name (without directory part). | ||
| 842 | Archiving to a different file is useful to keep archived entries from | ||
| 843 | contributing to the Org-mode Agenda. | ||
| 844 | |||
| 845 | The part after the double colon is a headline. The archived entries will be | ||
| 846 | filed under that headline. When omitted, the subtrees are simply filed away | ||
| 847 | at the end of the file, as top-level entries. | ||
| 848 | |||
| 849 | Here are a few examples: | ||
| 850 | \"%s_archive::\" | ||
| 851 | If the current file is Projects.org, archive in file | ||
| 852 | Projects.org_archive, as top-level trees. This is the default. | ||
| 853 | |||
| 854 | \"::* Archived Tasks\" | ||
| 855 | Archive in the current file, under the top-level headline | ||
| 856 | \"* Archived Tasks\". | ||
| 857 | |||
| 858 | \"~/org/archive.org::\" | ||
| 859 | Archive in file ~/org/archive.org (absolute path), as top-level trees. | ||
| 860 | |||
| 861 | \"basement::** Finished Tasks\" | ||
| 862 | Archive in file ./basement (relative path), as level 3 trees | ||
| 863 | below the level 2 heading \"** Finished Tasks\". | ||
| 864 | |||
| 865 | You may set this option on a per-file basis by adding to the buffer a | ||
| 866 | line like | ||
| 867 | |||
| 868 | #+ARCHIVE: basement::** Finished Tasks" | ||
| 869 | :group 'org-structure | ||
| 870 | :type 'string) | ||
| 871 | |||
| 872 | (defcustom org-archive-mark-done t | ||
| 873 | "Non-nil means, mark archived entries as DONE." | ||
| 874 | :group 'org-structure | ||
| 875 | :type 'boolean) | ||
| 876 | |||
| 877 | (defcustom org-archive-stamp-time t | ||
| 878 | "Non-nil means, add a time stamp to archived entries. | ||
| 879 | The time stamp will be added directly after the TODO state keyword in the | ||
| 880 | first line, so it is probably best to use this in combinations with | ||
| 881 | `org-archive-mark-done'." | ||
| 882 | :group 'org-structure | ||
| 883 | :type 'boolean) | ||
| 769 | 884 | ||
| 770 | (defgroup org-link nil | 885 | (defgroup org-link nil |
| 771 | "Options concerning links in Org-mode." | 886 | "Options concerning links in Org-mode." |
| 772 | :tag "Org Link" | 887 | :tag "Org Link" |
| 773 | :group 'org) | 888 | :group 'org) |
| 774 | 889 | ||
| 890 | (defcustom org-link-format "<%s>" | ||
| 891 | "Default format for linkes in the buffer. | ||
| 892 | This is a format string for printf, %s will be replaced by the link text. | ||
| 893 | If you want to make sure that your link is always properly terminated, | ||
| 894 | include angle brackets into this format, like \"<%s>\". Some people also | ||
| 895 | recommend an additional URL: prefix, so the format would be \"<URL:%s>\"." | ||
| 896 | :group 'org-link | ||
| 897 | :type '(choice | ||
| 898 | (const :tag "\"%s\" (e.g. http://www.there.com)" "%s") | ||
| 899 | (const :tag "\"<%s>\" (e.g. <http://www.there.com>)" "<%s>") | ||
| 900 | (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>") | ||
| 901 | (string :tag "Other" :value "<%s>"))) | ||
| 902 | |||
| 775 | (defcustom org-allow-space-in-links t | 903 | (defcustom org-allow-space-in-links t |
| 776 | "Non-nil means, file names in links may contain space characters. | 904 | "Non-nil means, file names in links may contain space characters. |
| 777 | When nil, it becomes possible to put several links into a line. | 905 | When nil, it becomes possible to put several links into a line. |
| @@ -1310,7 +1438,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1310 | :tag "Org Faces" | 1438 | :tag "Org Faces" |
| 1311 | :group 'org) | 1439 | :group 'org) |
| 1312 | 1440 | ||
| 1313 | (defface org-level-1-face ;; font-lock-function-name-face | 1441 | (defface org-level-1 ;; font-lock-function-name-face |
| 1314 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) | 1442 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) |
| 1315 | (((class color) (background light)) (:foreground "Blue")) | 1443 | (((class color) (background light)) (:foreground "Blue")) |
| 1316 | (((class color) (background dark)) (:foreground "LightSkyBlue")) | 1444 | (((class color) (background dark)) (:foreground "LightSkyBlue")) |
| @@ -1318,7 +1446,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1318 | "Face used for level 1 headlines." | 1446 | "Face used for level 1 headlines." |
| 1319 | :group 'org-faces) | 1447 | :group 'org-faces) |
| 1320 | 1448 | ||
| 1321 | (defface org-level-2-face ;; font-lock-variable-name-face | 1449 | (defface org-level-2 ;; font-lock-variable-name-face |
| 1322 | '((((type tty) (class color)) (:foreground "yellow" :weight light)) | 1450 | '((((type tty) (class color)) (:foreground "yellow" :weight light)) |
| 1323 | (((class color) (background light)) (:foreground "DarkGoldenrod")) | 1451 | (((class color) (background light)) (:foreground "DarkGoldenrod")) |
| 1324 | (((class color) (background dark)) (:foreground "LightGoldenrod")) | 1452 | (((class color) (background dark)) (:foreground "LightGoldenrod")) |
| @@ -1326,7 +1454,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1326 | "Face used for level 2 headlines." | 1454 | "Face used for level 2 headlines." |
| 1327 | :group 'org-faces) | 1455 | :group 'org-faces) |
| 1328 | 1456 | ||
| 1329 | (defface org-level-3-face ;; font-lock-keyword-face | 1457 | (defface org-level-3 ;; font-lock-keyword-face |
| 1330 | '((((type tty) (class color)) (:foreground "cyan" :weight bold)) | 1458 | '((((type tty) (class color)) (:foreground "cyan" :weight bold)) |
| 1331 | (((class color) (background light)) (:foreground "Purple")) | 1459 | (((class color) (background light)) (:foreground "Purple")) |
| 1332 | (((class color) (background dark)) (:foreground "Cyan")) | 1460 | (((class color) (background dark)) (:foreground "Cyan")) |
| @@ -1334,7 +1462,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1334 | "Face used for level 3 headlines." | 1462 | "Face used for level 3 headlines." |
| 1335 | :group 'org-faces) | 1463 | :group 'org-faces) |
| 1336 | 1464 | ||
| 1337 | (defface org-level-4-face ;; font-lock-comment-face | 1465 | (defface org-level-4 ;; font-lock-comment-face |
| 1338 | '((((type tty pc) (class color) (background light)) (:foreground "red")) | 1466 | '((((type tty pc) (class color) (background light)) (:foreground "red")) |
| 1339 | (((type tty pc) (class color) (background dark)) (:foreground "red1")) | 1467 | (((type tty pc) (class color) (background dark)) (:foreground "red1")) |
| 1340 | (((class color) (background light)) (:foreground "Firebrick")) | 1468 | (((class color) (background light)) (:foreground "Firebrick")) |
| @@ -1343,7 +1471,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1343 | "Face used for level 4 headlines." | 1471 | "Face used for level 4 headlines." |
| 1344 | :group 'org-faces) | 1472 | :group 'org-faces) |
| 1345 | 1473 | ||
| 1346 | (defface org-level-5-face ;; font-lock-type-face | 1474 | (defface org-level-5 ;; font-lock-type-face |
| 1347 | '((((type tty) (class color)) (:foreground "green")) | 1475 | '((((type tty) (class color)) (:foreground "green")) |
| 1348 | (((class color) (background light)) (:foreground "ForestGreen")) | 1476 | (((class color) (background light)) (:foreground "ForestGreen")) |
| 1349 | (((class color) (background dark)) (:foreground "PaleGreen")) | 1477 | (((class color) (background dark)) (:foreground "PaleGreen")) |
| @@ -1351,7 +1479,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1351 | "Face used for level 5 headlines." | 1479 | "Face used for level 5 headlines." |
| 1352 | :group 'org-faces) | 1480 | :group 'org-faces) |
| 1353 | 1481 | ||
| 1354 | (defface org-level-6-face ;; font-lock-constant-face | 1482 | (defface org-level-6 ;; font-lock-constant-face |
| 1355 | '((((type tty) (class color)) (:foreground "magenta")) | 1483 | '((((type tty) (class color)) (:foreground "magenta")) |
| 1356 | (((class color) (background light)) (:foreground "CadetBlue")) | 1484 | (((class color) (background light)) (:foreground "CadetBlue")) |
| 1357 | (((class color) (background dark)) (:foreground "Aquamarine")) | 1485 | (((class color) (background dark)) (:foreground "Aquamarine")) |
| @@ -1359,7 +1487,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1359 | "Face used for level 6 headlines." | 1487 | "Face used for level 6 headlines." |
| 1360 | :group 'org-faces) | 1488 | :group 'org-faces) |
| 1361 | 1489 | ||
| 1362 | (defface org-level-7-face ;; font-lock-builtin-face | 1490 | (defface org-level-7 ;; font-lock-builtin-face |
| 1363 | '((((type tty) (class color)) (:foreground "blue" :weight light)) | 1491 | '((((type tty) (class color)) (:foreground "blue" :weight light)) |
| 1364 | (((class color) (background light)) (:foreground "Orchid")) | 1492 | (((class color) (background light)) (:foreground "Orchid")) |
| 1365 | (((class color) (background dark)) (:foreground "LightSteelBlue")) | 1493 | (((class color) (background dark)) (:foreground "LightSteelBlue")) |
| @@ -1367,7 +1495,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1367 | "Face used for level 7 headlines." | 1495 | "Face used for level 7 headlines." |
| 1368 | :group 'org-faces) | 1496 | :group 'org-faces) |
| 1369 | 1497 | ||
| 1370 | (defface org-level-8-face ;; font-lock-string-face | 1498 | (defface org-level-8 ;; font-lock-string-face |
| 1371 | '((((type tty) (class color)) (:foreground "green")) | 1499 | '((((type tty) (class color)) (:foreground "green")) |
| 1372 | (((class color) (background light)) (:foreground "RosyBrown")) | 1500 | (((class color) (background light)) (:foreground "RosyBrown")) |
| 1373 | (((class color) (background dark)) (:foreground "LightSalmon")) | 1501 | (((class color) (background dark)) (:foreground "LightSalmon")) |
| @@ -1375,7 +1503,7 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1375 | "Face used for level 8 headlines." | 1503 | "Face used for level 8 headlines." |
| 1376 | :group 'org-faces) | 1504 | :group 'org-faces) |
| 1377 | 1505 | ||
| 1378 | (defface org-warning-face ;; font-lock-warning-face | 1506 | (defface org-warning ;; font-lock-warning-face |
| 1379 | '((((type tty) (class color)) (:foreground "red")) | 1507 | '((((type tty) (class color)) (:foreground "red")) |
| 1380 | (((class color) (background light)) (:foreground "Red" :bold t)) | 1508 | (((class color) (background light)) (:foreground "Red" :bold t)) |
| 1381 | (((class color) (background dark)) (:foreground "Red1" :bold t)) | 1509 | (((class color) (background dark)) (:foreground "Red1" :bold t)) |
| @@ -1388,11 +1516,11 @@ Otherwise, the buffer will just be saved to a file and stay hidden." | |||
| 1388 | "Non-nil means, change the face of a headline if it is marked DONE. | 1516 | "Non-nil means, change the face of a headline if it is marked DONE. |
| 1389 | Normally, only the TODO/DONE keyword indicates the state of a headline. | 1517 | Normally, only the TODO/DONE keyword indicates the state of a headline. |
| 1390 | When this is non-nil, the headline after the keyword is set to the | 1518 | When this is non-nil, the headline after the keyword is set to the |
| 1391 | `org-headline-done-face' as an additional indication." | 1519 | `org-headline-done' as an additional indication." |
| 1392 | :group 'org-faces | 1520 | :group 'org-faces |
| 1393 | :type 'boolean) | 1521 | :type 'boolean) |
| 1394 | 1522 | ||
| 1395 | (defface org-headline-done-face ;; font-lock-string-face | 1523 | (defface org-headline-done ;; font-lock-string-face |
| 1396 | '((((type tty) (class color)) (:foreground "green")) | 1524 | '((((type tty) (class color)) (:foreground "green")) |
| 1397 | (((class color) (background light)) (:foreground "RosyBrown")) | 1525 | (((class color) (background light)) (:foreground "RosyBrown")) |
| 1398 | (((class color) (background dark)) (:foreground "LightSalmon")) | 1526 | (((class color) (background dark)) (:foreground "LightSalmon")) |
| @@ -1403,7 +1531,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1403 | 1531 | ||
| 1404 | ;; Inheritance does not yet work for xemacs. So we just copy... | 1532 | ;; Inheritance does not yet work for xemacs. So we just copy... |
| 1405 | 1533 | ||
| 1406 | (defface org-deadline-announce-face | 1534 | (defface org-deadline-announce |
| 1407 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) | 1535 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) |
| 1408 | (((class color) (background light)) (:foreground "Blue")) | 1536 | (((class color) (background light)) (:foreground "Blue")) |
| 1409 | (((class color) (background dark)) (:foreground "LightSkyBlue")) | 1537 | (((class color) (background dark)) (:foreground "LightSkyBlue")) |
| @@ -1411,7 +1539,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1411 | "Face for upcoming deadlines." | 1539 | "Face for upcoming deadlines." |
| 1412 | :group 'org-faces) | 1540 | :group 'org-faces) |
| 1413 | 1541 | ||
| 1414 | (defface org-scheduled-today-face | 1542 | (defface org-scheduled-today |
| 1415 | '((((type tty) (class color)) (:foreground "green")) | 1543 | '((((type tty) (class color)) (:foreground "green")) |
| 1416 | (((class color) (background light)) (:foreground "DarkGreen")) | 1544 | (((class color) (background light)) (:foreground "DarkGreen")) |
| 1417 | (((class color) (background dark)) (:foreground "PaleGreen")) | 1545 | (((class color) (background dark)) (:foreground "PaleGreen")) |
| @@ -1419,7 +1547,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1419 | "Face for items scheduled for a certain day." | 1547 | "Face for items scheduled for a certain day." |
| 1420 | :group 'org-faces) | 1548 | :group 'org-faces) |
| 1421 | 1549 | ||
| 1422 | (defface org-scheduled-previously-face | 1550 | (defface org-scheduled-previously |
| 1423 | '((((type tty pc) (class color) (background light)) (:foreground "red")) | 1551 | '((((type tty pc) (class color) (background light)) (:foreground "red")) |
| 1424 | (((type tty pc) (class color) (background dark)) (:foreground "red1")) | 1552 | (((type tty pc) (class color) (background dark)) (:foreground "red1")) |
| 1425 | (((class color) (background light)) (:foreground "Firebrick")) | 1553 | (((class color) (background light)) (:foreground "Firebrick")) |
| @@ -1428,7 +1556,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1428 | "Face for items scheduled previously, and not yet done." | 1556 | "Face for items scheduled previously, and not yet done." |
| 1429 | :group 'org-faces) | 1557 | :group 'org-faces) |
| 1430 | 1558 | ||
| 1431 | (defface org-link-face | 1559 | (defface org-link |
| 1432 | '((((type tty) (class color)) (:foreground "cyan" :weight bold)) | 1560 | '((((type tty) (class color)) (:foreground "cyan" :weight bold)) |
| 1433 | (((class color) (background light)) (:foreground "Purple")) | 1561 | (((class color) (background light)) (:foreground "Purple")) |
| 1434 | (((class color) (background dark)) (:foreground "Cyan")) | 1562 | (((class color) (background dark)) (:foreground "Cyan")) |
| @@ -1436,7 +1564,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1436 | "Face for links." | 1564 | "Face for links." |
| 1437 | :group 'org-faces) | 1565 | :group 'org-faces) |
| 1438 | 1566 | ||
| 1439 | (defface org-done-face ;; font-lock-type-face | 1567 | (defface org-done ;; font-lock-type-face |
| 1440 | '((((type tty) (class color)) (:foreground "green")) | 1568 | '((((type tty) (class color)) (:foreground "green")) |
| 1441 | (((class color) (background light)) (:foreground "ForestGreen" :bold t)) | 1569 | (((class color) (background light)) (:foreground "ForestGreen" :bold t)) |
| 1442 | (((class color) (background dark)) (:foreground "PaleGreen" :bold t)) | 1570 | (((class color) (background dark)) (:foreground "PaleGreen" :bold t)) |
| @@ -1444,7 +1572,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1444 | "Face used for DONE." | 1572 | "Face used for DONE." |
| 1445 | :group 'org-faces) | 1573 | :group 'org-faces) |
| 1446 | 1574 | ||
| 1447 | (defface org-table-face ;; font-lock-function-name-face | 1575 | (defface org-table ;; font-lock-function-name-face |
| 1448 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) | 1576 | '((((type tty) (class color)) (:foreground "blue" :weight bold)) |
| 1449 | (((class color) (background light)) (:foreground "Blue")) | 1577 | (((class color) (background light)) (:foreground "Blue")) |
| 1450 | (((class color) (background dark)) (:foreground "LightSkyBlue")) | 1578 | (((class color) (background dark)) (:foreground "LightSkyBlue")) |
| @@ -1452,7 +1580,7 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1452 | "Face used for tables." | 1580 | "Face used for tables." |
| 1453 | :group 'org-faces) | 1581 | :group 'org-faces) |
| 1454 | 1582 | ||
| 1455 | (defface org-time-grid-face ;; font-lock-variable-name-face | 1583 | (defface org-time-grid ;; font-lock-variable-name-face |
| 1456 | '((((type tty) (class color)) (:foreground "yellow" :weight light)) | 1584 | '((((type tty) (class color)) (:foreground "yellow" :weight light)) |
| 1457 | (((class color) (background light)) (:foreground "DarkGoldenrod")) | 1585 | (((class color) (background light)) (:foreground "DarkGoldenrod")) |
| 1458 | (((class color) (background dark)) (:foreground "LightGoldenrod")) | 1586 | (((class color) (background dark)) (:foreground "LightGoldenrod")) |
| @@ -1462,14 +1590,14 @@ When this is non-nil, the headline after the keyword is set to the | |||
| 1462 | 1590 | ||
| 1463 | (defvar org-level-faces | 1591 | (defvar org-level-faces |
| 1464 | '( | 1592 | '( |
| 1465 | org-level-1-face | 1593 | org-level-1 |
| 1466 | org-level-2-face | 1594 | org-level-2 |
| 1467 | org-level-3-face | 1595 | org-level-3 |
| 1468 | org-level-4-face | 1596 | org-level-4 |
| 1469 | org-level-5-face | 1597 | org-level-5 |
| 1470 | org-level-6-face | 1598 | org-level-6 |
| 1471 | org-level-7-face | 1599 | org-level-7 |
| 1472 | org-level-8-face | 1600 | org-level-8 |
| 1473 | )) | 1601 | )) |
| 1474 | (defvar org-n-levels (length org-level-faces)) | 1602 | (defvar org-n-levels (length org-level-faces)) |
| 1475 | 1603 | ||
| @@ -1535,7 +1663,7 @@ sets it back to nil.") | |||
| 1535 | 1663 | ||
| 1536 | ;;;###autoload | 1664 | ;;;###autoload |
| 1537 | (define-derived-mode org-mode outline-mode "Org" | 1665 | (define-derived-mode org-mode outline-mode "Org" |
| 1538 | "Outline-based notes management and organizer, alias | 1666 | "Outline-based notes management and organizer, alias |
| 1539 | \"Carstens outline-mode for keeping track of everything.\" | 1667 | \"Carstens outline-mode for keeping track of everything.\" |
| 1540 | 1668 | ||
| 1541 | Org-mode develops organizational tasks around a NOTES file which | 1669 | Org-mode develops organizational tasks around a NOTES file which |
| @@ -1564,6 +1692,9 @@ The following commands are available: | |||
| 1564 | (make-local-hook 'before-change-functions) ;; needed for XEmacs | 1692 | (make-local-hook 'before-change-functions) ;; needed for XEmacs |
| 1565 | (add-hook 'before-change-functions 'org-before-change-function nil | 1693 | (add-hook 'before-change-functions 'org-before-change-function nil |
| 1566 | 'local) | 1694 | 'local) |
| 1695 | ;; Paragraph regular expressions | ||
| 1696 | (set (make-local-variable 'paragraph-separate) "\f\\|[ ]*$") | ||
| 1697 | (set (make-local-variable 'paragraph-start) "\f\\|[ ]*$\\|\\([*\f]+\\)") | ||
| 1567 | ;; Inhibit auto-fill for headers, tables and fixed-width lines. | 1698 | ;; Inhibit auto-fill for headers, tables and fixed-width lines. |
| 1568 | (set (make-local-variable 'auto-fill-inhibit-regexp) | 1699 | (set (make-local-variable 'auto-fill-inhibit-regexp) |
| 1569 | (concat "\\*" | 1700 | (concat "\\*" |
| @@ -1573,6 +1704,7 @@ The following commands are available: | |||
| 1573 | (if org-enable-table-editor "|" "") | 1704 | (if org-enable-table-editor "|" "") |
| 1574 | (if org-enable-fixed-width-editor ":" "") | 1705 | (if org-enable-fixed-width-editor ":" "") |
| 1575 | "]")))) | 1706 | "]")))) |
| 1707 | (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph) | ||
| 1576 | (if (and org-insert-mode-line-in-empty-file | 1708 | (if (and org-insert-mode-line-in-empty-file |
| 1577 | (interactive-p) | 1709 | (interactive-p) |
| 1578 | (= (point-min) (point-max))) | 1710 | (= (point-min) (point-max))) |
| @@ -1587,25 +1719,38 @@ The following commands are available: | |||
| 1587 | (let ((this-command 'org-cycle) (last-command 'org-cycle)) | 1719 | (let ((this-command 'org-cycle) (last-command 'org-cycle)) |
| 1588 | (org-cycle '(4)) (org-cycle '(4)))))))) | 1720 | (org-cycle '(4)) (org-cycle '(4)))))))) |
| 1589 | 1721 | ||
| 1722 | (defun org-fill-paragraph (&optional justify) | ||
| 1723 | "Re-align a table, pass through to fill-paragraph if no table." | ||
| 1724 | (save-excursion | ||
| 1725 | (beginning-of-line 1) | ||
| 1726 | (looking-at "\\s-*\\(|\\|\\+-+\\)"))) | ||
| 1727 | |||
| 1590 | ;;; Font-Lock stuff | 1728 | ;;; Font-Lock stuff |
| 1591 | 1729 | ||
| 1592 | (defvar org-mouse-map (make-sparse-keymap)) | 1730 | (defvar org-mouse-map (make-sparse-keymap)) |
| 1593 | (define-key org-mouse-map | 1731 | (define-key org-mouse-map |
| 1594 | (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse) | 1732 | (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse) |
| 1595 | (define-key org-mouse-map | 1733 | (define-key org-mouse-map |
| 1596 | (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse) | 1734 | (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse) |
| 1597 | 1735 | ||
| 1598 | (require 'font-lock) | 1736 | (require 'font-lock) |
| 1599 | 1737 | ||
| 1600 | (defconst org-non-link-chars "\t\n\r|") | 1738 | (defconst org-non-link-chars "\t\n\r|<>\000") |
| 1601 | (defconst org-link-regexp | 1739 | (defconst org-link-regexp |
| 1602 | (if org-allow-space-in-links | 1740 | (if org-allow-space-in-links |
| 1603 | (concat | 1741 | (concat |
| 1604 | "\\(https?\\|ftp\\|mailto|\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") | 1742 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") |
| 1605 | (concat | 1743 | (concat |
| 1606 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") | 1744 | "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") |
| 1607 | ) | 1745 | ) |
| 1608 | "Regular expression for matching links.") | 1746 | "Regular expression for matching links.") |
| 1747 | (defconst org-link-maybe-angles-regexp | ||
| 1748 | (concat "<?\\(" org-link-regexp "\\)>?") | ||
| 1749 | "Matches a link and optionally surrounding angle brackets.") | ||
| 1750 | (defconst org-protected-link-regexp | ||
| 1751 | (concat "\000" org-link-regexp "\000") | ||
| 1752 | "Matches a link and optionally surrounding angle brackets.") | ||
| 1753 | |||
| 1609 | (defconst org-ts-lengths | 1754 | (defconst org-ts-lengths |
| 1610 | (cons (length (format-time-string (car org-time-stamp-formats))) | 1755 | (cons (length (format-time-string (car org-time-stamp-formats))) |
| 1611 | (length (format-time-string (cdr org-time-stamp-formats)))) | 1756 | (length (format-time-string (cdr org-time-stamp-formats)))) |
| @@ -1650,37 +1795,37 @@ The following commands are available: | |||
| 1650 | (defun org-set-font-lock-defaults () | 1795 | (defun org-set-font-lock-defaults () |
| 1651 | (let ((org-font-lock-extra-keywords | 1796 | (let ((org-font-lock-extra-keywords |
| 1652 | (list | 1797 | (list |
| 1653 | '(org-activate-links (0 'org-link-face)) | 1798 | '(org-activate-links (0 'org-link)) |
| 1654 | '(org-activate-dates (0 'org-link-face)) | 1799 | '(org-activate-dates (0 'org-link)) |
| 1655 | (list (concat "^\\*+[ \t]*" org-not-done-regexp) | 1800 | (list (concat "^\\*+[ \t]*" org-not-done-regexp) |
| 1656 | '(1 'org-warning-face t)) | 1801 | '(1 'org-warning t)) |
| 1657 | (list (concat "\\[#[A-Z]\\]") '(0 'org-warning-face t)) | 1802 | (list (concat "\\[#[A-Z]\\]") '(0 'org-warning t)) |
| 1658 | (list (concat "\\<" org-deadline-string) '(0 'org-warning-face t)) | 1803 | (list (concat "\\<" org-deadline-string) '(0 'org-warning t)) |
| 1659 | (list (concat "\\<" org-scheduled-string) '(0 'org-warning-face t)) | 1804 | (list (concat "\\<" org-scheduled-string) '(0 'org-warning t)) |
| 1660 | ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" | 1805 | ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" |
| 1661 | ;; (3 'bold)) | 1806 | ;; (3 'bold)) |
| 1662 | ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" | 1807 | ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" |
| 1663 | ;; (3 'italic)) | 1808 | ;; (3 'italic)) |
| 1664 | ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" | 1809 | ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" |
| 1665 | ;; (3 'underline)) | 1810 | ;; (3 'underline)) |
| 1666 | '("\\<FIXME\\>" (0 'org-warning-face t)) | 1811 | '("\\<FIXME\\>" (0 'org-warning t)) |
| 1667 | (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>") | 1812 | (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>") |
| 1668 | '(1 'org-warning-face t)) | 1813 | '(1 'org-warning t)) |
| 1669 | '("^#.*" (0 'font-lock-comment-face t)) | 1814 | '("^#.*" (0 'font-lock-comment-face t)) |
| 1670 | (if org-fontify-done-headline | 1815 | (if org-fontify-done-headline |
| 1671 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") | 1816 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") |
| 1672 | '(1 'org-done-face t) '(2 'org-headline-done-face t)) | 1817 | '(1 'org-done t) '(2 'org-headline-done t)) |
| 1673 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") | 1818 | (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") |
| 1674 | '(1 'org-done-face t))) | 1819 | '(1 'org-done t))) |
| 1675 | '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" | 1820 | '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" |
| 1676 | (1 'org-table-face t)) | 1821 | (1 'org-table t)) |
| 1677 | '("^[ \t]*\\(:.*\\)" (1 'org-table-face t))))) | 1822 | '("^[ \t]*\\(:.*\\)" (1 'org-table t))))) |
| 1678 | (set (make-local-variable 'org-font-lock-keywords) | 1823 | (set (make-local-variable 'org-font-lock-keywords) |
| 1679 | (append | 1824 | (append |
| 1680 | (if org-noutline-p ; FIXME: I am not sure if eval will work | 1825 | (if org-noutline-p ; FIXME: I am not sure if eval will work |
| 1681 | ; on XEmacs if noutline is ever ported | 1826 | ; on XEmacs if noutline is ever ported |
| 1682 | '((eval . (list "^\\(\\*+\\).*" | 1827 | '((eval . (list "^\\(\\*+\\).*" |
| 1683 | 0 '(nth | 1828 | 0 '(nth |
| 1684 | (% (- (match-end 1) (match-beginning 1) 1) | 1829 | (% (- (match-end 1) (match-beginning 1) 1) |
| 1685 | org-n-levels) | 1830 | org-n-levels) |
| 1686 | org-level-faces) | 1831 | org-level-faces) |
| @@ -1694,7 +1839,7 @@ The following commands are available: | |||
| 1694 | (set (make-local-variable 'font-lock-defaults) | 1839 | (set (make-local-variable 'font-lock-defaults) |
| 1695 | '(org-font-lock-keywords t nil nil backward-paragraph)) | 1840 | '(org-font-lock-keywords t nil nil backward-paragraph)) |
| 1696 | (kill-local-variable 'font-lock-keywords) nil)) | 1841 | (kill-local-variable 'font-lock-keywords) nil)) |
| 1697 | 1842 | ||
| 1698 | (defun org-unfontify-region (beg end &optional maybe_loudly) | 1843 | (defun org-unfontify-region (beg end &optional maybe_loudly) |
| 1699 | "Remove fontification and activation overlays from links." | 1844 | "Remove fontification and activation overlays from links." |
| 1700 | (font-lock-default-unfontify-region beg end) | 1845 | (font-lock-default-unfontify-region beg end) |
| @@ -1885,12 +2030,12 @@ Optional argument N means, put the headline into the Nth line of the window." | |||
| 1885 | (let ((cmds '(isearch-forward isearch-backward)) cmd) | 2030 | (let ((cmds '(isearch-forward isearch-backward)) cmd) |
| 1886 | (while (setq cmd (pop cmds)) | 2031 | (while (setq cmd (pop cmds)) |
| 1887 | (substitute-key-definition cmd cmd org-goto-map global-map))) | 2032 | (substitute-key-definition cmd cmd org-goto-map global-map))) |
| 1888 | (define-key org-goto-map [(return)] 'org-goto-ret) | 2033 | (define-key org-goto-map "\C-m" 'org-goto-ret) |
| 1889 | (define-key org-goto-map [(left)] 'org-goto-left) | 2034 | (define-key org-goto-map [(left)] 'org-goto-left) |
| 1890 | (define-key org-goto-map [(right)] 'org-goto-right) | 2035 | (define-key org-goto-map [(right)] 'org-goto-right) |
| 1891 | (define-key org-goto-map [(?q)] 'org-goto-quit) | 2036 | (define-key org-goto-map [(?q)] 'org-goto-quit) |
| 1892 | (define-key org-goto-map [(control ?g)] 'org-goto-quit) | 2037 | (define-key org-goto-map [(control ?g)] 'org-goto-quit) |
| 1893 | (define-key org-goto-map [(tab)] 'org-cycle) | 2038 | (define-key org-goto-map "\C-i" 'org-cycle) |
| 1894 | (define-key org-goto-map [(down)] 'outline-next-visible-heading) | 2039 | (define-key org-goto-map [(down)] 'outline-next-visible-heading) |
| 1895 | (define-key org-goto-map [(up)] 'outline-previous-visible-heading) | 2040 | (define-key org-goto-map [(up)] 'outline-previous-visible-heading) |
| 1896 | (define-key org-goto-map "n" 'outline-next-visible-heading) | 2041 | (define-key org-goto-map "n" 'outline-next-visible-heading) |
| @@ -2094,7 +2239,7 @@ in the region." | |||
| 2094 | (org-back-to-heading t) | 2239 | (org-back-to-heading t) |
| 2095 | (let* ((level (save-match-data (funcall outline-level))) | 2240 | (let* ((level (save-match-data (funcall outline-level))) |
| 2096 | (up-head (make-string (1- level) ?*))) | 2241 | (up-head (make-string (1- level) ?*))) |
| 2097 | (if (= level 1) (error "Cannot promote to level 0. UNDO to recover.")) | 2242 | (if (= level 1) (error "Cannot promote to level 0. UNDO to recover")) |
| 2098 | (replace-match up-head nil t) | 2243 | (replace-match up-head nil t) |
| 2099 | (if org-adapt-indentation | 2244 | (if org-adapt-indentation |
| 2100 | (org-fixup-indentation "^ " "" "^ ?\\S-")))) | 2245 | (org-fixup-indentation "^ " "" "^ ?\\S-")))) |
| @@ -2275,15 +2420,21 @@ If optional TREE is given, use this text instead of the kill ring." | |||
| 2275 | (- (match-end 0) (match-beginning 0))) | 2420 | (- (match-end 0) (match-beginning 0))) |
| 2276 | (t nil))) | 2421 | (t nil))) |
| 2277 | (previous-level (save-excursion | 2422 | (previous-level (save-excursion |
| 2278 | (outline-previous-visible-heading 1) | 2423 | (condition-case nil |
| 2279 | (if (looking-at re) | 2424 | (progn |
| 2280 | (- (match-end 0) (match-beginning 0)) | 2425 | (outline-previous-visible-heading 1) |
| 2281 | 1))) | 2426 | (if (looking-at re) |
| 2427 | (- (match-end 0) (match-beginning 0)) | ||
| 2428 | 1)) | ||
| 2429 | (error 1)))) | ||
| 2282 | (next-level (save-excursion | 2430 | (next-level (save-excursion |
| 2283 | (outline-next-visible-heading 1) | 2431 | (condition-case nil |
| 2284 | (if (looking-at re) | 2432 | (progn |
| 2285 | (- (match-end 0) (match-beginning 0)) | 2433 | (outline-next-visible-heading 1) |
| 2286 | 1))) | 2434 | (if (looking-at re) |
| 2435 | (- (match-end 0) (match-beginning 0)) | ||
| 2436 | 1)) | ||
| 2437 | (error 1)))) | ||
| 2287 | (new-level (or force-level (max previous-level next-level))) | 2438 | (new-level (or force-level (max previous-level next-level))) |
| 2288 | (shift (if (or (= old-level -1) | 2439 | (shift (if (or (= old-level -1) |
| 2289 | (= new-level -1) | 2440 | (= new-level -1) |
| @@ -2342,6 +2493,102 @@ If optional TXT is given, check this string instead of the current kill." | |||
| 2342 | (throw 'exit nil))) | 2493 | (throw 'exit nil))) |
| 2343 | t)))) | 2494 | t)))) |
| 2344 | 2495 | ||
| 2496 | (defun org-archive-subtree () | ||
| 2497 | "Move the current subtree to the archive. | ||
| 2498 | The archive can be a certain top-level heading in the current file, or in | ||
| 2499 | a different file. The tree will be moved to that location, the subtree | ||
| 2500 | heading be marked DONE, and the current time will be added." | ||
| 2501 | (interactive) | ||
| 2502 | ;; Save all relevant TODO keyword-relatex variables | ||
| 2503 | (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler | ||
| 2504 | (tr-org-todo-keywords org-todo-keywords) | ||
| 2505 | (tr-org-todo-interpretation org-todo-interpretation) | ||
| 2506 | (tr-org-done-string org-done-string) | ||
| 2507 | (tr-org-todo-regexp org-todo-regexp) | ||
| 2508 | (tr-org-todo-line-regexp org-todo-line-regexp) | ||
| 2509 | (this-buffer (current-buffer)) | ||
| 2510 | file heading buffer level newfile-p) | ||
| 2511 | (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) | ||
| 2512 | (progn | ||
| 2513 | (setq file (format (match-string 1 org-archive-location) | ||
| 2514 | (file-name-nondirectory (buffer-file-name))) | ||
| 2515 | heading (match-string 2 org-archive-location))) | ||
| 2516 | (error "Invalid `org-archive-location'")) | ||
| 2517 | (if (> (length file) 0) | ||
| 2518 | (setq newfile-p (not (file-exists-p file)) | ||
| 2519 | buffer (find-file-noselect file)) | ||
| 2520 | (setq buffer (current-buffer))) | ||
| 2521 | (unless buffer | ||
| 2522 | (error "Cannot access file \"%s\"" file)) | ||
| 2523 | (if (and (> (length heading) 0) | ||
| 2524 | (string-match "^\\*+" heading)) | ||
| 2525 | (setq level (match-end 0)) | ||
| 2526 | (setq heading nil level 0)) | ||
| 2527 | (save-excursion | ||
| 2528 | (org-copy-subtree) ; We first only copy, in case something goes wrong | ||
| 2529 | (set-buffer buffer) | ||
| 2530 | ;; Enforce org-mode for the archive buffer | ||
| 2531 | (if (not (eq major-mode 'org-mode)) | ||
| 2532 | ;; Force the mode for future visits. | ||
| 2533 | (let ((org-insert-mode-line-in-empty-file t)) | ||
| 2534 | (call-interactively 'org-mode))) | ||
| 2535 | (when newfile-p | ||
| 2536 | (goto-char (point-max)) | ||
| 2537 | (insert (format "\nArchived entries from file %s\n\n" | ||
| 2538 | (buffer-file-name this-buffer)))) | ||
| 2539 | ;; Force the TODO keywords of the original buffer | ||
| 2540 | (let ((org-todo-line-regexp tr-org-todo-line-regexp) | ||
| 2541 | (org-todo-keywords tr-org-todo-keywords) | ||
| 2542 | (org-todo-interpretation tr-org-todo-interpretation) | ||
| 2543 | (org-done-string tr-org-done-string) | ||
| 2544 | (org-todo-regexp tr-org-todo-regexp) | ||
| 2545 | (org-todo-line-regexp tr-org-todo-line-regexp)) | ||
| 2546 | (goto-char (point-min)) | ||
| 2547 | (if heading | ||
| 2548 | (progn | ||
| 2549 | (if (re-search-forward | ||
| 2550 | (concat "\\(^\\|\r\\)" | ||
| 2551 | (regexp-quote heading) "[ \t]*\\($\\|\r\\)") | ||
| 2552 | nil t) | ||
| 2553 | (goto-char (match-end 0)) | ||
| 2554 | ;; Heading not found, just insert it at the end | ||
| 2555 | (goto-char (point-max)) | ||
| 2556 | (or (bolp) (insert "\n")) | ||
| 2557 | (insert "\n" heading "\n") | ||
| 2558 | (end-of-line 0)) | ||
| 2559 | ;; Make the heading visible, and the following as well | ||
| 2560 | (let ((org-show-following-heading t)) (org-show-hierarchy-above)) | ||
| 2561 | (if (re-search-forward | ||
| 2562 | (concat "^" (regexp-quote (make-string level ?*)) "[ \t]") | ||
| 2563 | nil t) | ||
| 2564 | (progn (goto-char (match-beginning 0)) (insert "\n") | ||
| 2565 | (beginning-of-line 0)) | ||
| 2566 | (goto-char (point-max)) (insert "\n"))) | ||
| 2567 | (goto-char (point-max)) (insert "\n")) | ||
| 2568 | ;; Paste | ||
| 2569 | (org-paste-subtree (1+ level)) | ||
| 2570 | ;; Mark the entry as done, i.e. set to last work in org-todo-keywords | ||
| 2571 | (if org-archive-mark-done | ||
| 2572 | (org-todo (length org-todo-keywords))) | ||
| 2573 | ;; Move cursor to right after the TODO keyword | ||
| 2574 | (when org-archive-stamp-time | ||
| 2575 | (beginning-of-line 1) | ||
| 2576 | (looking-at org-todo-line-regexp) | ||
| 2577 | (goto-char (or (match-end 2) (match-beginning 3))) | ||
| 2578 | (insert "(" (format-time-string (cdr org-time-stamp-formats) | ||
| 2579 | (current-time)) | ||
| 2580 | ")")) | ||
| 2581 | ;; Save the buffer, if it is not the same buffer. | ||
| 2582 | (if (not (eq this-buffer buffer)) (save-buffer)))) | ||
| 2583 | ;; Here we are back in the original buffer. Everything seems to have | ||
| 2584 | ;; worked. So now cut the tree and finish up. | ||
| 2585 | (org-cut-subtree) | ||
| 2586 | (if (looking-at "[ \t]*$") (kill-line)) | ||
| 2587 | (message "Subtree archived %s" | ||
| 2588 | (if (eq this-buffer buffer) | ||
| 2589 | (concat "under heading: " heading) | ||
| 2590 | (concat "in file: " (abbreviate-file-name file)))))) | ||
| 2591 | |||
| 2345 | ;;; Completion | 2592 | ;;; Completion |
| 2346 | 2593 | ||
| 2347 | (defun org-complete (&optional arg) | 2594 | (defun org-complete (&optional arg) |
| @@ -2370,11 +2617,11 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 2370 | (table (cond | 2617 | (table (cond |
| 2371 | (opt | 2618 | (opt |
| 2372 | (setq type :opt) | 2619 | (setq type :opt) |
| 2373 | (mapcar (lambda (x) | 2620 | (mapcar (lambda (x) |
| 2374 | (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) | 2621 | (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) |
| 2375 | (cons (match-string 2 x) (match-string 1 x))) | 2622 | (cons (match-string 2 x) (match-string 1 x))) |
| 2376 | (org-split-string (org-get-current-options) "\n"))) | 2623 | (org-split-string (org-get-current-options) "\n"))) |
| 2377 | (texp | 2624 | (texp |
| 2378 | (setq type :tex) | 2625 | (setq type :tex) |
| 2379 | org-html-entities) | 2626 | org-html-entities) |
| 2380 | ((string-match "\\`\\*+[ \t]*\\'" | 2627 | ((string-match "\\`\\*+[ \t]*\\'" |
| @@ -2384,7 +2631,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 2384 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) | 2631 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) |
| 2385 | (completion (try-completion pattern table))) | 2632 | (completion (try-completion pattern table))) |
| 2386 | (cond ((eq completion t) | 2633 | (cond ((eq completion t) |
| 2387 | (if (equal type :opt) | 2634 | (if (equal type :opt) |
| 2388 | (insert (substring (cdr (assoc (upcase pattern) table)) | 2635 | (insert (substring (cdr (assoc (upcase pattern) table)) |
| 2389 | (length pattern))))) | 2636 | (length pattern))))) |
| 2390 | ((null completion) | 2637 | ((null completion) |
| @@ -2392,7 +2639,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 2392 | (ding)) | 2639 | (ding)) |
| 2393 | ((not (string= pattern completion)) | 2640 | ((not (string= pattern completion)) |
| 2394 | (delete-region beg end) | 2641 | (delete-region beg end) |
| 2395 | (if (string-match " +$" completion) | 2642 | (if (string-match " +$" completion) |
| 2396 | (setq completion (replace-match "" t t completion))) | 2643 | (setq completion (replace-match "" t t completion))) |
| 2397 | (insert completion) | 2644 | (insert completion) |
| 2398 | (if (get-buffer-window "*Completions*") | 2645 | (if (get-buffer-window "*Completions*") |
| @@ -2629,9 +2876,9 @@ ACTION can be set, up, or down." | |||
| 2629 | (save-match-data | 2876 | (save-match-data |
| 2630 | (if (not (string-match org-priority-regexp s)) | 2877 | (if (not (string-match org-priority-regexp s)) |
| 2631 | (* 1000 (- org-lowest-priority org-default-priority)) | 2878 | (* 1000 (- org-lowest-priority org-default-priority)) |
| 2632 | (* 1000 (- org-lowest-priority | 2879 | (* 1000 (- org-lowest-priority |
| 2633 | (string-to-char (match-string 2 s))))))) | 2880 | (string-to-char (match-string 2 s))))))) |
| 2634 | 2881 | ||
| 2635 | ;;; Timestamps | 2882 | ;;; Timestamps |
| 2636 | 2883 | ||
| 2637 | (defvar org-last-changed-timestamp nil) | 2884 | (defvar org-last-changed-timestamp nil) |
| @@ -2663,7 +2910,7 @@ at the cursor, it will be modified." | |||
| 2663 | (setq time (let ((this-command this-command)) | 2910 | (setq time (let ((this-command this-command)) |
| 2664 | (org-read-date arg 'totime))) | 2911 | (org-read-date arg 'totime))) |
| 2665 | (and (org-at-timestamp-p) (replace-match | 2912 | (and (org-at-timestamp-p) (replace-match |
| 2666 | (setq org-last-changed-timestamp | 2913 | (setq org-last-changed-timestamp |
| 2667 | (format-time-string fmt time)) | 2914 | (format-time-string fmt time)) |
| 2668 | t t)) | 2915 | t t)) |
| 2669 | (message "Timestamp updated")) | 2916 | (message "Timestamp updated")) |
| @@ -2693,8 +2940,8 @@ but this can be configured with the variables `parse-time-months' and | |||
| 2693 | 2940 | ||
| 2694 | While prompting, a calendar is popped up - you can also select the | 2941 | While prompting, a calendar is popped up - you can also select the |
| 2695 | date with the mouse (button 1). The calendar shows a period of three | 2942 | date with the mouse (button 1). The calendar shows a period of three |
| 2696 | month. To scroll it to other months, use the keys `>' and `<'. | 2943 | month. To scroll it to other months, use the keys `>' and `<'. |
| 2697 | If you don't like the calendar, turn it off with | 2944 | If you don't like the calendar, turn it off with |
| 2698 | \(setq org-popup-calendar-for-date-prompt nil). | 2945 | \(setq org-popup-calendar-for-date-prompt nil). |
| 2699 | 2946 | ||
| 2700 | With optional argument TO-TIME, the date will immediately be converted | 2947 | With optional argument TO-TIME, the date will immediately be converted |
| @@ -2708,7 +2955,7 @@ used to insert the time stamp into the buffer to include the time." | |||
| 2708 | ;; Default time is either today, or, when entering a range, | 2955 | ;; Default time is either today, or, when entering a range, |
| 2709 | ;; the range start. | 2956 | ;; the range start. |
| 2710 | (if (save-excursion | 2957 | (if (save-excursion |
| 2711 | (re-search-backward | 2958 | (re-search-backward |
| 2712 | (concat org-ts-regexp "--\\=") | 2959 | (concat org-ts-regexp "--\\=") |
| 2713 | (- (point) 20) t)) | 2960 | (- (point) 20) t)) |
| 2714 | (apply | 2961 | (apply |
| @@ -2819,7 +3066,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer." | |||
| 2819 | (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) | 3066 | (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date)))) |
| 2820 | (setq ans1 (format-time-string "%Y-%m-%d" time))) | 3067 | (setq ans1 (format-time-string "%Y-%m-%d" time))) |
| 2821 | (if (active-minibuffer-window) (exit-minibuffer)))) | 3068 | (if (active-minibuffer-window) (exit-minibuffer)))) |
| 2822 | 3069 | ||
| 2823 | (defun org-check-deadlines (ndays) | 3070 | (defun org-check-deadlines (ndays) |
| 2824 | "Check if there are any deadlines due or past due. | 3071 | "Check if there are any deadlines due or past due. |
| 2825 | A deadline is considered due if it happens within `org-deadline-warning-days' | 3072 | A deadline is considered due if it happens within `org-deadline-warning-days' |
| @@ -2859,7 +3106,7 @@ days in order to avoid rounding problems." | |||
| 2859 | (goto-char (point-at-bol)) | 3106 | (goto-char (point-at-bol)) |
| 2860 | (re-search-forward org-tr-regexp (point-at-eol) t)) | 3107 | (re-search-forward org-tr-regexp (point-at-eol) t)) |
| 2861 | (if (not (org-at-date-range-p)) | 3108 | (if (not (org-at-date-range-p)) |
| 2862 | (error "Not at a time-stamp range, and none found in current line."))) | 3109 | (error "Not at a time-stamp range, and none found in current line"))) |
| 2863 | (let* ((ts1 (match-string 1)) | 3110 | (let* ((ts1 (match-string 1)) |
| 2864 | (ts2 (match-string 2)) | 3111 | (ts2 (match-string 2)) |
| 2865 | (havetime (or (> (length ts1) 15) (> (length ts2) 15))) | 3112 | (havetime (or (> (length ts1) 15) (> (length ts2) 15))) |
| @@ -3092,6 +3339,7 @@ If there is already a time stamp at the cursor position, update it." | |||
| 3092 | (defvar org-agenda-follow-mode nil) | 3339 | (defvar org-agenda-follow-mode nil) |
| 3093 | (defvar org-agenda-buffer-name "*Org Agenda*") | 3340 | (defvar org-agenda-buffer-name "*Org Agenda*") |
| 3094 | (defvar org-agenda-redo-command nil) | 3341 | (defvar org-agenda-redo-command nil) |
| 3342 | (defvar org-agenda-mode-hook nil) | ||
| 3095 | 3343 | ||
| 3096 | ;;;###autoload | 3344 | ;;;###autoload |
| 3097 | (defun org-agenda-mode () | 3345 | (defun org-agenda-mode () |
| @@ -3110,27 +3358,29 @@ The following commands are available: | |||
| 3110 | (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) | 3358 | (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local) |
| 3111 | (add-hook 'pre-command-hook 'org-unhighlight nil 'local) | 3359 | (add-hook 'pre-command-hook 'org-unhighlight nil 'local) |
| 3112 | (setq org-agenda-follow-mode nil) | 3360 | (setq org-agenda-follow-mode nil) |
| 3113 | (easy-menu-change | 3361 | (easy-menu-change |
| 3114 | '("Agenda") "Agenda Files" | 3362 | '("Agenda") "Agenda Files" |
| 3115 | (append | 3363 | (append |
| 3116 | (list | 3364 | (list |
| 3117 | ["Edit File List" (customize-variable 'org-agenda-files) t] | 3365 | ["Edit File List" (customize-variable 'org-agenda-files) t] |
| 3118 | "--") | 3366 | "--") |
| 3119 | (mapcar 'org-file-menu-entry org-agenda-files))) | 3367 | (mapcar 'org-file-menu-entry org-agenda-files))) |
| 3120 | (org-agenda-set-mode-name) | 3368 | (org-agenda-set-mode-name) |
| 3121 | (run-mode-hooks 'org-agenda-mode-hook)) | 3369 | (apply |
| 3370 | (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks) | ||
| 3371 | org-agenda-mode-hook)) | ||
| 3122 | 3372 | ||
| 3123 | (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) | 3373 | (define-key org-agenda-mode-map "\C-i" 'org-agenda-goto) |
| 3124 | (define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to) | 3374 | (define-key org-agenda-mode-map "\C-m" 'org-agenda-switch-to) |
| 3125 | (define-key org-agenda-mode-map " " 'org-agenda-show) | 3375 | (define-key org-agenda-mode-map " " 'org-agenda-show) |
| 3126 | (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) | 3376 | (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) |
| 3127 | (define-key org-agenda-mode-map "o" 'delete-other-windows) | 3377 | (define-key org-agenda-mode-map "o" 'delete-other-windows) |
| 3128 | (define-key org-agenda-mode-map "l" 'org-agenda-recenter) | 3378 | (define-key org-agenda-mode-map "l" 'org-agenda-recenter) |
| 3129 | (define-key org-agenda-mode-map "t" 'org-agenda-todo) | 3379 | (define-key org-agenda-mode-map "t" 'org-agenda-todo) |
| 3130 | (define-key org-agenda-mode-map "." 'org-agenda-goto-today) | 3380 | (define-key org-agenda-mode-map "." 'org-agenda-goto-today) |
| 3131 | (define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view) | 3381 | (define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view) |
| 3132 | (define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later) | 3382 | (define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later) |
| 3133 | (define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) | 3383 | (define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier) |
| 3134 | 3384 | ||
| 3135 | (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) | 3385 | (define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) |
| 3136 | (let ((l '(1 2 3 4 5 6 7 8 9 0))) | 3386 | (let ((l '(1 2 3 4 5 6 7 8 9 0))) |
| @@ -3164,15 +3414,15 @@ The following commands are available: | |||
| 3164 | (define-key org-agenda-mode-map "H" 'org-agenda-holidays) | 3414 | (define-key org-agenda-mode-map "H" 'org-agenda-holidays) |
| 3165 | (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) | 3415 | (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) |
| 3166 | (define-key org-agenda-mode-map "-" 'org-agenda-priority-down) | 3416 | (define-key org-agenda-mode-map "-" 'org-agenda-priority-down) |
| 3167 | (define-key org-agenda-mode-map [(shift up)] 'org-agenda-priority-up) | 3417 | (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) |
| 3168 | (define-key org-agenda-mode-map [(shift down)] 'org-agenda-priority-down) | 3418 | (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) |
| 3169 | (define-key org-agenda-mode-map [(right)] 'org-agenda-later) | 3419 | (define-key org-agenda-mode-map [(right)] 'org-agenda-later) |
| 3170 | (define-key org-agenda-mode-map [(left)] 'org-agenda-earlier) | 3420 | (define-key org-agenda-mode-map [(left)] 'org-agenda-earlier) |
| 3171 | 3421 | ||
| 3172 | (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) | 3422 | (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) |
| 3173 | "Local keymap for agenda entries from Org-mode.") | 3423 | "Local keymap for agenda entries from Org-mode.") |
| 3174 | 3424 | ||
| 3175 | (define-key org-agenda-keymap | 3425 | (define-key org-agenda-keymap |
| 3176 | (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) | 3426 | (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) |
| 3177 | (define-key org-agenda-keymap | 3427 | (define-key org-agenda-keymap |
| 3178 | (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) | 3428 | (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) |
| @@ -3184,7 +3434,7 @@ The following commands are available: | |||
| 3184 | ["Show" org-agenda-show t] | 3434 | ["Show" org-agenda-show t] |
| 3185 | ["Go To (other window)" org-agenda-goto t] | 3435 | ["Go To (other window)" org-agenda-goto t] |
| 3186 | ["Go To (one window)" org-agenda-switch-to t] | 3436 | ["Go To (one window)" org-agenda-switch-to t] |
| 3187 | ["Follow Mode" org-agenda-follow-mode | 3437 | ["Follow Mode" org-agenda-follow-mode |
| 3188 | :style toggle :selected org-agenda-follow-mode :active t] | 3438 | :style toggle :selected org-agenda-follow-mode :active t] |
| 3189 | "--" | 3439 | "--" |
| 3190 | ["Cycle TODO" org-agenda-todo t] | 3440 | ["Cycle TODO" org-agenda-todo t] |
| @@ -3302,7 +3552,7 @@ dates." | |||
| 3302 | (org-respect-restriction t) | 3552 | (org-respect-restriction t) |
| 3303 | (past t) | 3553 | (past t) |
| 3304 | s e rtn d) | 3554 | s e rtn d) |
| 3305 | (setq org-agenda-redo-command | 3555 | (setq org-agenda-redo-command |
| 3306 | (list 'progn | 3556 | (list 'progn |
| 3307 | (list 'switch-to-buffer-other-window (current-buffer)) | 3557 | (list 'switch-to-buffer-other-window (current-buffer)) |
| 3308 | (list 'org-timeline include-all))) | 3558 | (list 'org-timeline include-all))) |
| @@ -3311,7 +3561,7 @@ dates." | |||
| 3311 | (setq day-numbers (delq nil (mapcar (lambda(x) | 3561 | (setq day-numbers (delq nil (mapcar (lambda(x) |
| 3312 | (if (>= x today) x nil)) | 3562 | (if (>= x today) x nil)) |
| 3313 | day-numbers)))) | 3563 | day-numbers)))) |
| 3314 | (switch-to-buffer-other-window | 3564 | (switch-to-buffer-other-window |
| 3315 | (get-buffer-create org-agenda-buffer-name)) | 3565 | (get-buffer-create org-agenda-buffer-name)) |
| 3316 | (setq buffer-read-only nil) | 3566 | (setq buffer-read-only nil) |
| 3317 | (erase-buffer) | 3567 | (erase-buffer) |
| @@ -3326,7 +3576,7 @@ dates." | |||
| 3326 | (setq date (calendar-gregorian-from-absolute d)) | 3576 | (setq date (calendar-gregorian-from-absolute d)) |
| 3327 | (setq s (point)) | 3577 | (setq s (point)) |
| 3328 | (if dotodo | 3578 | (if dotodo |
| 3329 | (setq rtn (org-agenda-get-day-entries | 3579 | (setq rtn (org-agenda-get-day-entries |
| 3330 | entry date :todo :timestamp)) | 3580 | entry date :todo :timestamp)) |
| 3331 | (setq rtn (org-agenda-get-day-entries entry date :timestamp))) | 3581 | (setq rtn (org-agenda-get-day-entries entry date :timestamp))) |
| 3332 | (if (or rtn (equal d today)) | 3582 | (if (or rtn (equal d today)) |
| @@ -3336,7 +3586,7 @@ dates." | |||
| 3336 | (calendar-month-name (extract-calendar-month date)) " " | 3586 | (calendar-month-name (extract-calendar-month date)) " " |
| 3337 | (number-to-string (extract-calendar-year date)) "\n") | 3587 | (number-to-string (extract-calendar-year date)) "\n") |
| 3338 | (put-text-property s (1- (point)) 'face | 3588 | (put-text-property s (1- (point)) 'face |
| 3339 | 'org-link-face) | 3589 | 'org-link) |
| 3340 | (if (equal d today) | 3590 | (if (equal d today) |
| 3341 | (put-text-property s (1- (point)) 'org-today t)) | 3591 | (put-text-property s (1- (point)) 'org-today t)) |
| 3342 | (insert (org-finalize-agenda-entries rtn) "\n") | 3592 | (insert (org-finalize-agenda-entries rtn) "\n") |
| @@ -3382,7 +3632,7 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 3382 | (day-numbers (list start)) | 3632 | (day-numbers (list start)) |
| 3383 | (inhibit-redisplay t) | 3633 | (inhibit-redisplay t) |
| 3384 | s e rtn rtnall file date d start-pos end-pos todayp nd) | 3634 | s e rtn rtnall file date d start-pos end-pos todayp nd) |
| 3385 | (setq org-agenda-redo-command | 3635 | (setq org-agenda-redo-command |
| 3386 | (list 'org-agenda include-all start-day ndays)) | 3636 | (list 'org-agenda include-all start-day ndays)) |
| 3387 | ;; Make the list of days | 3637 | ;; Make the list of days |
| 3388 | (setq ndays (or ndays org-agenda-ndays) | 3638 | (setq ndays (or ndays org-agenda-ndays) |
| @@ -3394,7 +3644,7 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 3394 | (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name))) | 3644 | (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name))) |
| 3395 | (progn | 3645 | (progn |
| 3396 | (delete-other-windows) | 3646 | (delete-other-windows) |
| 3397 | (switch-to-buffer-other-window | 3647 | (switch-to-buffer-other-window |
| 3398 | (get-buffer-create org-agenda-buffer-name)))) | 3648 | (get-buffer-create org-agenda-buffer-name)))) |
| 3399 | (setq buffer-read-only nil) | 3649 | (setq buffer-read-only nil) |
| 3400 | (erase-buffer) | 3650 | (erase-buffer) |
| @@ -3412,10 +3662,10 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 3412 | rtn (org-agenda-get-day-entries | 3662 | rtn (org-agenda-get-day-entries |
| 3413 | file date :todo)) | 3663 | file date :todo)) |
| 3414 | (setq rtnall (append rtnall rtn)))) | 3664 | (setq rtnall (append rtnall rtn)))) |
| 3415 | (when rtnall | 3665 | (when rtnall |
| 3416 | (insert "ALL CURRENTLY OPEN TODO ITEMS:\n") | 3666 | (insert "ALL CURRENTLY OPEN TODO ITEMS:\n") |
| 3417 | (add-text-properties (point-min) (1- (point)) | 3667 | (add-text-properties (point-min) (1- (point)) |
| 3418 | (list 'face 'org-link-face)) | 3668 | (list 'face 'org-link)) |
| 3419 | (insert (org-finalize-agenda-entries rtnall) "\n"))) | 3669 | (insert (org-finalize-agenda-entries rtnall) "\n"))) |
| 3420 | (while (setq d (pop day-numbers)) | 3670 | (while (setq d (pop day-numbers)) |
| 3421 | (setq date (calendar-gregorian-from-absolute d) | 3671 | (setq date (calendar-gregorian-from-absolute d) |
| @@ -3445,13 +3695,13 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 3445 | (calendar-month-name (extract-calendar-month date)) | 3695 | (calendar-month-name (extract-calendar-month date)) |
| 3446 | (extract-calendar-year date))) | 3696 | (extract-calendar-year date))) |
| 3447 | (put-text-property s (1- (point)) 'face | 3697 | (put-text-property s (1- (point)) 'face |
| 3448 | 'org-link-face) | 3698 | 'org-link) |
| 3449 | (if rtnall (insert | 3699 | (if rtnall (insert |
| 3450 | (org-finalize-agenda-entries ;; FIXME: condition needed | 3700 | (org-finalize-agenda-entries ;; FIXME: condition needed |
| 3451 | (org-agenda-add-time-grid-maybe | 3701 | (org-agenda-add-time-grid-maybe |
| 3452 | rtnall nd todayp)) | 3702 | rtnall nd todayp)) |
| 3453 | "\n")) | 3703 | "\n")) |
| 3454 | (put-text-property s (1- (point)) 'day d)))) | 3704 | (put-text-property s (1- (point)) 'day d)))) |
| 3455 | (goto-char (point-min)) | 3705 | (goto-char (point-min)) |
| 3456 | (setq buffer-read-only t) | 3706 | (setq buffer-read-only t) |
| 3457 | (if org-fit-agenda-window | 3707 | (if org-fit-agenda-window |
| @@ -3541,7 +3791,7 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3541 | (error "Not allowed")) | 3791 | (error "Not allowed")) |
| 3542 | (setq org-agenda-ndays | 3792 | (setq org-agenda-ndays |
| 3543 | (if (equal org-agenda-ndays 1) 7 1)) | 3793 | (if (equal org-agenda-ndays 1) 7 1)) |
| 3544 | (org-agenda include-all-loc | 3794 | (org-agenda include-all-loc |
| 3545 | (or (get-text-property (point) 'day) | 3795 | (or (get-text-property (point) 'day) |
| 3546 | starting-day)) | 3796 | starting-day)) |
| 3547 | (org-agenda-set-mode-name) | 3797 | (org-agenda-set-mode-name) |
| @@ -3556,7 +3806,7 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3556 | (if (not (re-search-forward "^\\S-" nil t arg)) | 3806 | (if (not (re-search-forward "^\\S-" nil t arg)) |
| 3557 | (progn | 3807 | (progn |
| 3558 | (backward-char 1) | 3808 | (backward-char 1) |
| 3559 | (error "No next date after this line in this buffer."))) | 3809 | (error "No next date after this line in this buffer"))) |
| 3560 | (goto-char (match-beginning 0))) | 3810 | (goto-char (match-beginning 0))) |
| 3561 | 3811 | ||
| 3562 | (defun org-agenda-previous-date-line (&optional arg) | 3812 | (defun org-agenda-previous-date-line (&optional arg) |
| @@ -3564,7 +3814,7 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3564 | (interactive "p") | 3814 | (interactive "p") |
| 3565 | (beginning-of-line 1) | 3815 | (beginning-of-line 1) |
| 3566 | (if (not (re-search-backward "^\\S-" nil t arg)) | 3816 | (if (not (re-search-backward "^\\S-" nil t arg)) |
| 3567 | (error "No previous date before this line in this buffer."))) | 3817 | (error "No previous date before this line in this buffer"))) |
| 3568 | 3818 | ||
| 3569 | ;; Initialize the highlight | 3819 | ;; Initialize the highlight |
| 3570 | (defvar org-hl (funcall (if org-xemacs-p 'make-extent 'make-overlay) 1 1)) | 3820 | (defvar org-hl (funcall (if org-xemacs-p 'make-extent 'make-overlay) 1 1)) |
| @@ -3630,7 +3880,7 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3630 | "Get the (Emacs Calendar) diary entries for DATE." | 3880 | "Get the (Emacs Calendar) diary entries for DATE." |
| 3631 | (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*") | 3881 | (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*") |
| 3632 | (diary-display-hook '(fancy-diary-display)) | 3882 | (diary-display-hook '(fancy-diary-display)) |
| 3633 | (list-diary-entries-hook | 3883 | (list-diary-entries-hook |
| 3634 | (cons 'org-diary-default-entry list-diary-entries-hook)) | 3884 | (cons 'org-diary-default-entry list-diary-entries-hook)) |
| 3635 | entries | 3885 | entries |
| 3636 | (org-disable-diary t)) | 3886 | (org-disable-diary t)) |
| @@ -3654,12 +3904,12 @@ With prefix ARG, go back that many times `org-agenda-ndays'." | |||
| 3654 | (kill-buffer fancy-diary-buffer))) | 3904 | (kill-buffer fancy-diary-buffer))) |
| 3655 | (when entries | 3905 | (when entries |
| 3656 | (setq entries (org-split-string entries "\n")) | 3906 | (setq entries (org-split-string entries "\n")) |
| 3657 | (setq entries | 3907 | (setq entries |
| 3658 | (mapcar | 3908 | (mapcar |
| 3659 | (lambda (x) | 3909 | (lambda (x) |
| 3660 | (setq x (org-format-agenda-item "" x "Diary" 'time)) | 3910 | (setq x (org-format-agenda-item "" x "Diary" 'time)) |
| 3661 | ;; Extend the text properties to the beginning of the line | 3911 | ;; Extend the text properties to the beginning of the line |
| 3662 | (add-text-properties | 3912 | (add-text-properties |
| 3663 | 0 (length x) | 3913 | 0 (length x) |
| 3664 | (text-properties-at (1- (length x)) x) | 3914 | (text-properties-at (1- (length x)) x) |
| 3665 | x) | 3915 | x) |
| @@ -3700,7 +3950,7 @@ date. Itt also removes lines that contain only whitespace." | |||
| 3700 | 0 (length string) | 3950 | 0 (length string) |
| 3701 | (list 'mouse-face 'highlight | 3951 | (list 'mouse-face 'highlight |
| 3702 | 'keymap org-agenda-keymap | 3952 | 'keymap org-agenda-keymap |
| 3703 | 'help-echo | 3953 | 'help-echo |
| 3704 | (format | 3954 | (format |
| 3705 | "mouse-2 or RET jump to diary file %s" | 3955 | "mouse-2 or RET jump to diary file %s" |
| 3706 | (abbreviate-file-name (buffer-file-name))) | 3956 | (abbreviate-file-name (buffer-file-name))) |
| @@ -3722,7 +3972,7 @@ Needed to avoid empty dates which mess up holiday display." | |||
| 3722 | These are the files which are being checked for agenda entries. | 3972 | These are the files which are being checked for agenda entries. |
| 3723 | Optional argument FILE means, use this file instead of the current. | 3973 | Optional argument FILE means, use this file instead of the current. |
| 3724 | It is possible (but not recommended) to add this function to the | 3974 | It is possible (but not recommended) to add this function to the |
| 3725 | `org-mode-hook'." | 3975 | `org-mode-hook'." |
| 3726 | (interactive) | 3976 | (interactive) |
| 3727 | (catch 'exit | 3977 | (catch 'exit |
| 3728 | (let* ((file (or file (buffer-file-name) | 3978 | (let* ((file (or file (buffer-file-name) |
| @@ -3737,7 +3987,7 @@ It is possible (but not recommended) to add this function to the | |||
| 3737 | org-agenda-files)))) | 3987 | org-agenda-files)))) |
| 3738 | (if (not present) | 3988 | (if (not present) |
| 3739 | (progn | 3989 | (progn |
| 3740 | (setq org-agenda-files | 3990 | (setq org-agenda-files |
| 3741 | (cons afile org-agenda-files)) | 3991 | (cons afile org-agenda-files)) |
| 3742 | ;; Make sure custom.el does not end up with Org-mode | 3992 | ;; Make sure custom.el does not end up with Org-mode |
| 3743 | (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode)) | 3993 | (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode)) |
| @@ -3754,7 +4004,7 @@ Optional argument FILE means, use this file instead of the current." | |||
| 3754 | (let* ((file (or file (buffer-file-name))) | 4004 | (let* ((file (or file (buffer-file-name))) |
| 3755 | (true-file (file-truename file)) | 4005 | (true-file (file-truename file)) |
| 3756 | (afile (abbreviate-file-name file)) | 4006 | (afile (abbreviate-file-name file)) |
| 3757 | (files (delq nil (mapcar | 4007 | (files (delq nil (mapcar |
| 3758 | (lambda (x) | 4008 | (lambda (x) |
| 3759 | (if (equal true-file | 4009 | (if (equal true-file |
| 3760 | (file-truename x)) | 4010 | (file-truename x)) |
| @@ -3839,7 +4089,7 @@ also be written as | |||
| 3839 | 4089 | ||
| 3840 | The function expects the lisp variables `entry' and `date' to be provided | 4090 | The function expects the lisp variables `entry' and `date' to be provided |
| 3841 | by the caller, because this is how the calendar works. Don't use this | 4091 | by the caller, because this is how the calendar works. Don't use this |
| 3842 | function from a program - use `org-agenda-get-day-entries' instead." | 4092 | function from a program - use `org-agenda-get-day-entries' instead." |
| 3843 | (org-agenda-maybe-reset-markers) | 4093 | (org-agenda-maybe-reset-markers) |
| 3844 | (org-compile-agenda-prefix-format org-agenda-prefix-format) | 4094 | (org-compile-agenda-prefix-format org-agenda-prefix-format) |
| 3845 | (setq args (or args '(:deadline :scheduled :timestamp))) | 4095 | (setq args (or args '(:deadline :scheduled :timestamp))) |
| @@ -3881,7 +4131,7 @@ the documentation of `org-diary'." | |||
| 3881 | (if (org-region-active-p) | 4131 | (if (org-region-active-p) |
| 3882 | ;; Respect a region to restrict search | 4132 | ;; Respect a region to restrict search |
| 3883 | (narrow-to-region (region-beginning) (region-end))) | 4133 | (narrow-to-region (region-beginning) (region-end))) |
| 3884 | ;; If we work for the calendar or many files, | 4134 | ;; If we work for the calendar or many files, |
| 3885 | ;; get rid of any restriction | 4135 | ;; get rid of any restriction |
| 3886 | (widen)) | 4136 | (widen)) |
| 3887 | ;; The way we repeatedly append to `results' makes it O(n^2) :-( | 4137 | ;; The way we repeatedly append to `results' makes it O(n^2) :-( |
| @@ -3932,7 +4182,7 @@ the documentation of `org-diary'." | |||
| 3932 | (defun org-agenda-get-todos () | 4182 | (defun org-agenda-get-todos () |
| 3933 | "Return the TODO information for agenda display." | 4183 | "Return the TODO information for agenda display." |
| 3934 | (let* ((props (list 'face nil | 4184 | (let* ((props (list 'face nil |
| 3935 | 'done-face 'org-done-face | 4185 | 'done-face 'org-done |
| 3936 | 'mouse-face 'highlight | 4186 | 'mouse-face 'highlight |
| 3937 | 'keymap org-agenda-keymap | 4187 | 'keymap org-agenda-keymap |
| 3938 | 'help-echo | 4188 | 'help-echo |
| @@ -3947,7 +4197,7 @@ the documentation of `org-diary'." | |||
| 3947 | (goto-char (match-beginning 1)) | 4197 | (goto-char (match-beginning 1)) |
| 3948 | (setq marker (org-agenda-new-marker (point-at-bol)) | 4198 | (setq marker (org-agenda-new-marker (point-at-bol)) |
| 3949 | txt (org-format-agenda-item "" (match-string 1)) | 4199 | txt (org-format-agenda-item "" (match-string 1)) |
| 3950 | priority | 4200 | priority |
| 3951 | (+ (org-get-priority txt) | 4201 | (+ (org-get-priority txt) |
| 3952 | (if org-todo-kwd-priority-p | 4202 | (if org-todo-kwd-priority-p |
| 3953 | (- org-todo-kwd-max-priority -2 | 4203 | (- org-todo-kwd-max-priority -2 |
| @@ -4019,18 +4269,18 @@ the documentation of `org-diary'." | |||
| 4019 | (if deadlinep | 4269 | (if deadlinep |
| 4020 | (add-text-properties | 4270 | (add-text-properties |
| 4021 | 0 (length txt) | 4271 | 0 (length txt) |
| 4022 | (list 'face | 4272 | (list 'face |
| 4023 | (if donep 'org-done-face 'org-warning-face) | 4273 | (if donep 'org-done 'org-warning) |
| 4024 | 'undone-face 'org-warning-face | 4274 | 'undone-face 'org-warning |
| 4025 | 'done-face 'org-done-face | 4275 | 'done-face 'org-done |
| 4026 | 'priority (+ 100 priority)) | 4276 | 'priority (+ 100 priority)) |
| 4027 | txt) | 4277 | txt) |
| 4028 | (if scheduledp | 4278 | (if scheduledp |
| 4029 | (add-text-properties | 4279 | (add-text-properties |
| 4030 | 0 (length txt) | 4280 | 0 (length txt) |
| 4031 | (list 'face 'org-scheduled-today-face | 4281 | (list 'face 'org-scheduled-today |
| 4032 | 'undone-face 'org-scheduled-today-face | 4282 | 'undone-face 'org-scheduled-today |
| 4033 | 'done-face 'org-done-face | 4283 | 'done-face 'org-done |
| 4034 | priority (+ 99 priority)) | 4284 | priority (+ 99 priority)) |
| 4035 | txt) | 4285 | txt) |
| 4036 | (add-text-properties | 4286 | (add-text-properties |
| @@ -4079,19 +4329,19 @@ the documentation of `org-diary'." | |||
| 4079 | (setq txt org-agenda-no-heading-message)) | 4329 | (setq txt org-agenda-no-heading-message)) |
| 4080 | (when txt | 4330 | (when txt |
| 4081 | (add-text-properties | 4331 | (add-text-properties |
| 4082 | 0 (length txt) | 4332 | 0 (length txt) |
| 4083 | (append | 4333 | (append |
| 4084 | (list 'org-marker (org-agenda-new-marker pos) | 4334 | (list 'org-marker (org-agenda-new-marker pos) |
| 4085 | 'org-hd-marker (org-agenda-new-marker pos1) | 4335 | 'org-hd-marker (org-agenda-new-marker pos1) |
| 4086 | 'priority (+ (- 10 diff) (org-get-priority txt)) | 4336 | 'priority (+ (- 10 diff) (org-get-priority txt)) |
| 4087 | 'face (cond ((<= diff 0) 'org-warning-face) | 4337 | 'face (cond ((<= diff 0) 'org-warning) |
| 4088 | ((<= diff 5) 'org-scheduled-previously-face) | 4338 | ((<= diff 5) 'org-scheduled-previously) |
| 4089 | (t nil)) | 4339 | (t nil)) |
| 4090 | 'undone-face (cond | 4340 | 'undone-face (cond |
| 4091 | ((<= diff 0) 'org-warning-face) | 4341 | ((<= diff 0) 'org-warning) |
| 4092 | ((<= diff 5) 'org-scheduled-previously-face) | 4342 | ((<= diff 5) 'org-scheduled-previously) |
| 4093 | (t nil)) | 4343 | (t nil)) |
| 4094 | 'done-face 'org-done-face) | 4344 | 'done-face 'org-done) |
| 4095 | props) | 4345 | props) |
| 4096 | txt) | 4346 | txt) |
| 4097 | (push txt ee))))) | 4347 | (push txt ee))))) |
| @@ -4099,9 +4349,9 @@ the documentation of `org-diary'." | |||
| 4099 | 4349 | ||
| 4100 | (defun org-agenda-get-scheduled () | 4350 | (defun org-agenda-get-scheduled () |
| 4101 | "Return the scheduled information for agenda display." | 4351 | "Return the scheduled information for agenda display." |
| 4102 | (let* ((props (list 'face 'org-scheduled-previously-face | 4352 | (let* ((props (list 'face 'org-scheduled-previously |
| 4103 | 'undone-face 'org-scheduled-previously-face | 4353 | 'undone-face 'org-scheduled-previously |
| 4104 | 'done-face 'org-done-face | 4354 | 'done-face 'org-done |
| 4105 | 'mouse-face 'highlight | 4355 | 'mouse-face 'highlight |
| 4106 | 'keymap org-agenda-keymap | 4356 | 'keymap org-agenda-keymap |
| 4107 | 'help-echo | 4357 | 'help-echo |
| @@ -4172,7 +4422,7 @@ the documentation of `org-diary'." | |||
| 4172 | (setq hdmarker (org-agenda-new-marker (match-end 1))) | 4422 | (setq hdmarker (org-agenda-new-marker (match-end 1))) |
| 4173 | (goto-char (match-end 1)) | 4423 | (goto-char (match-end 1)) |
| 4174 | (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") | 4424 | (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") |
| 4175 | (setq txt (org-format-agenda-item | 4425 | (setq txt (org-format-agenda-item |
| 4176 | (format (if (= d1 d2) "" "(%d/%d): ") | 4426 | (format (if (= d1 d2) "" "(%d/%d): ") |
| 4177 | (1+ (- d0 d1)) (1+ (- d2 d1))) | 4427 | (1+ (- d0 d1)) (1+ (- d2 d1))) |
| 4178 | (match-string 1) nil (if (= d0 d1) timestr)))) | 4428 | (match-string 1) nil (if (= d0 d1) timestr)))) |
| @@ -4254,7 +4504,7 @@ only the correctly processes TXT should be returned - this is used by | |||
| 4254 | (setq s0 (match-string 0 ts) | 4504 | (setq s0 (match-string 0 ts) |
| 4255 | s1 (match-string (if plain 1 2) ts) | 4505 | s1 (match-string (if plain 1 2) ts) |
| 4256 | s2 (match-string (if plain 8 4) ts)) | 4506 | s2 (match-string (if plain 8 4) ts)) |
| 4257 | 4507 | ||
| 4258 | ;; If the times are in TXT (not in DOTIMES), and the prefix will list | 4508 | ;; If the times are in TXT (not in DOTIMES), and the prefix will list |
| 4259 | ;; them, we might want to remove them there to avoid duplication. | 4509 | ;; them, we might want to remove them there to avoid duplication. |
| 4260 | ;; The user can turn this off with a variable. | 4510 | ;; The user can turn this off with a variable. |
| @@ -4267,7 +4517,7 @@ only the correctly processes TXT should be returned - this is used by | |||
| 4267 | ;; Normalize the time(s) to 24 hour | 4517 | ;; Normalize the time(s) to 24 hour |
| 4268 | (if s1 (setq s1 (org-get-time-of-day s1 'string))) | 4518 | (if s1 (setq s1 (org-get-time-of-day s1 'string))) |
| 4269 | (if s2 (setq s2 (org-get-time-of-day s2 'string)))) | 4519 | (if s2 (setq s2 (org-get-time-of-day s2 'string)))) |
| 4270 | 4520 | ||
| 4271 | ;; Create the final string | 4521 | ;; Create the final string |
| 4272 | (if noprefix | 4522 | (if noprefix |
| 4273 | (setq rtn txt) | 4523 | (setq rtn txt) |
| @@ -4279,7 +4529,7 @@ only the correctly processes TXT should be returned - this is used by | |||
| 4279 | category (if (symbolp category) (symbol-name category) category)) | 4529 | category (if (symbolp category) (symbol-name category) category)) |
| 4280 | ;; Evaluate the compiled format | 4530 | ;; Evaluate the compiled format |
| 4281 | (setq rtn (concat (eval org-prefix-format-compiled) txt))) | 4531 | (setq rtn (concat (eval org-prefix-format-compiled) txt))) |
| 4282 | 4532 | ||
| 4283 | ;; And finally add the text properties | 4533 | ;; And finally add the text properties |
| 4284 | (add-text-properties | 4534 | (add-text-properties |
| 4285 | 0 (length rtn) (list 'category (downcase category) | 4535 | 0 (length rtn) (list 'category (downcase category) |
| @@ -4310,12 +4560,12 @@ only the correctly processes TXT should be returned - this is used by | |||
| 4310 | (while (setq time (pop gridtimes)) | 4560 | (while (setq time (pop gridtimes)) |
| 4311 | (unless (and remove (member time have)) | 4561 | (unless (and remove (member time have)) |
| 4312 | (setq time (int-to-string time)) | 4562 | (setq time (int-to-string time)) |
| 4313 | (push (org-format-agenda-item | 4563 | (push (org-format-agenda-item |
| 4314 | nil string "" ;; FIXME: put a category? | 4564 | nil string "" ;; FIXME: put a category? |
| 4315 | (concat (substring time 0 -2) ":" (substring time -2))) | 4565 | (concat (substring time 0 -2) ":" (substring time -2))) |
| 4316 | new) | 4566 | new) |
| 4317 | (put-text-property | 4567 | (put-text-property |
| 4318 | 1 (length (car new)) 'face 'org-time-grid-face (car new)))) | 4568 | 1 (length (car new)) 'face 'org-time-grid (car new)))) |
| 4319 | (if (member 'time-up org-agenda-sorting-strategy) | 4569 | (if (member 'time-up org-agenda-sorting-strategy) |
| 4320 | (append new list) | 4570 | (append new list) |
| 4321 | (append list new))))) | 4571 | (append list new))))) |
| @@ -4353,7 +4603,7 @@ If not found, return nil. | |||
| 4353 | The optional STRING argument forces conversion into a 5 character wide string | 4603 | The optional STRING argument forces conversion into a 5 character wide string |
| 4354 | HH:MM." | 4604 | HH:MM." |
| 4355 | (save-match-data | 4605 | (save-match-data |
| 4356 | (when | 4606 | (when |
| 4357 | (or | 4607 | (or |
| 4358 | (string-match | 4608 | (string-match |
| 4359 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) | 4609 | "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) |
| @@ -4401,6 +4651,7 @@ HH:MM." | |||
| 4401 | 4651 | ||
| 4402 | (defun org-entries-lessp (a b) | 4652 | (defun org-entries-lessp (a b) |
| 4403 | "Predicate for sorting agenda entries." | 4653 | "Predicate for sorting agenda entries." |
| 4654 | ;; The following variables will be used when the form is evaluated. | ||
| 4404 | (let* ((time-up (org-cmp-time a b)) | 4655 | (let* ((time-up (org-cmp-time a b)) |
| 4405 | (time-down (if time-up (- time-up) nil)) | 4656 | (time-down (if time-up (- time-up) nil)) |
| 4406 | (priority-up (org-cmp-priority a b)) | 4657 | (priority-up (org-cmp-priority a b)) |
| @@ -4408,7 +4659,7 @@ HH:MM." | |||
| 4408 | (category-up (org-cmp-category a b)) | 4659 | (category-up (org-cmp-category a b)) |
| 4409 | (category-down (if category-up (- category-up) nil)) | 4660 | (category-down (if category-up (- category-up) nil)) |
| 4410 | (category-keep (if category-up +1 nil))) ; FIXME +1 or -1? | 4661 | (category-keep (if category-up +1 nil))) ; FIXME +1 or -1? |
| 4411 | (cdr (assoc | 4662 | (cdr (assoc |
| 4412 | (eval (cons 'or org-agenda-sorting-strategy)) | 4663 | (eval (cons 'or org-agenda-sorting-strategy)) |
| 4413 | '((-1 . t) (1 . nil) (nil . nil)))))) | 4664 | '((-1 . t) (1 . nil) (nil . nil)))))) |
| 4414 | 4665 | ||
| @@ -4423,7 +4674,7 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4423 | (defun org-agenda-goto (&optional highlight) | 4674 | (defun org-agenda-goto (&optional highlight) |
| 4424 | "Go to the Org-mode file which contains the item at point." | 4675 | "Go to the Org-mode file which contains the item at point." |
| 4425 | (interactive) | 4676 | (interactive) |
| 4426 | (let* ((marker (or (get-text-property (point) 'org-marker) | 4677 | (let* ((marker (or (get-text-property (point) 'org-marker) |
| 4427 | (org-agenda-error))) | 4678 | (org-agenda-error))) |
| 4428 | (buffer (marker-buffer marker)) | 4679 | (buffer (marker-buffer marker)) |
| 4429 | (pos (marker-position marker))) | 4680 | (pos (marker-position marker))) |
| @@ -4440,7 +4691,7 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4440 | (defun org-agenda-switch-to () | 4691 | (defun org-agenda-switch-to () |
| 4441 | "Go to the Org-mode file which contains the item at point." | 4692 | "Go to the Org-mode file which contains the item at point." |
| 4442 | (interactive) | 4693 | (interactive) |
| 4443 | (let* ((marker (or (get-text-property (point) 'org-marker) | 4694 | (let* ((marker (or (get-text-property (point) 'org-marker) |
| 4444 | (org-agenda-error))) | 4695 | (org-agenda-error))) |
| 4445 | (buffer (marker-buffer marker)) | 4696 | (buffer (marker-buffer marker)) |
| 4446 | (pos (marker-position marker))) | 4697 | (pos (marker-position marker))) |
| @@ -4487,7 +4738,7 @@ and by additional input from the age of a schedules or deadline entry." | |||
| 4487 | (org-agenda-error))) | 4738 | (org-agenda-error))) |
| 4488 | 4739 | ||
| 4489 | (defun org-agenda-error () | 4740 | (defun org-agenda-error () |
| 4490 | (error "Command not allowed in this line.")) | 4741 | (error "Command not allowed in this line")) |
| 4491 | 4742 | ||
| 4492 | (defvar org-last-heading-marker (make-marker) | 4743 | (defvar org-last-heading-marker (make-marker) |
| 4493 | "Marker pointing to the headline that last changed its TODO state | 4744 | "Marker pointing to the headline that last changed its TODO state |
| @@ -4554,7 +4805,7 @@ the new TODO state." | |||
| 4554 | (beginning-of-line 1) | 4805 | (beginning-of-line 1) |
| 4555 | (add-text-properties (point-at-bol) (point-at-eol) props) | 4806 | (add-text-properties (point-at-bol) (point-at-eol) props) |
| 4556 | (if fixface | 4807 | (if fixface |
| 4557 | (add-text-properties | 4808 | (add-text-properties |
| 4558 | (point-at-bol) (point-at-eol) | 4809 | (point-at-bol) (point-at-eol) |
| 4559 | (list 'face | 4810 | (list 'face |
| 4560 | (if org-last-todo-state-is-todo | 4811 | (if org-last-todo-state-is-todo |
| @@ -4651,7 +4902,7 @@ be used to request time specification in the time stamp." | |||
| 4651 | All the standard commands work: block, weekly etc" | 4902 | All the standard commands work: block, weekly etc" |
| 4652 | (interactive) | 4903 | (interactive) |
| 4653 | (require 'diary-lib) | 4904 | (require 'diary-lib) |
| 4654 | (let* ((char (progn | 4905 | (let* ((char (progn |
| 4655 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") | 4906 | (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic") |
| 4656 | (read-char-exclusive))) | 4907 | (read-char-exclusive))) |
| 4657 | (cmd (cdr (assoc char | 4908 | (cmd (cdr (assoc char |
| @@ -4681,7 +4932,7 @@ All the standard commands work: block, weekly etc" | |||
| 4681 | (progn | 4932 | (progn |
| 4682 | (fset 'calendar-cursor-to-date | 4933 | (fset 'calendar-cursor-to-date |
| 4683 | (lambda (&optional error) | 4934 | (lambda (&optional error) |
| 4684 | (calendar-gregorian-from-absolute | 4935 | (calendar-gregorian-from-absolute |
| 4685 | (get-text-property point 'day)))) | 4936 | (get-text-property point 'day)))) |
| 4686 | (call-interactively cmd)) | 4937 | (call-interactively cmd)) |
| 4687 | (fset 'calendar-cursor-to-date oldf))))) | 4938 | (fset 'calendar-cursor-to-date oldf))))) |
| @@ -4704,7 +4955,7 @@ the cursor position." | |||
| 4704 | (progn | 4955 | (progn |
| 4705 | (fset 'calendar-cursor-to-date | 4956 | (fset 'calendar-cursor-to-date |
| 4706 | (lambda (&optional error) | 4957 | (lambda (&optional error) |
| 4707 | (calendar-gregorian-from-absolute | 4958 | (calendar-gregorian-from-absolute |
| 4708 | (get-text-property point 'day)))) | 4959 | (get-text-property point 'day)))) |
| 4709 | (call-interactively cmd)) | 4960 | (call-interactively cmd)) |
| 4710 | (fset 'calendar-cursor-to-date oldf)))) | 4961 | (fset 'calendar-cursor-to-date oldf)))) |
| @@ -4754,7 +5005,7 @@ This is a command that has to be installed in `calendar-mode-map'." | |||
| 4754 | (unless day | 5005 | (unless day |
| 4755 | (error "Don't know which date to convert")) | 5006 | (error "Don't know which date to convert")) |
| 4756 | (setq date (calendar-gregorian-from-absolute day)) | 5007 | (setq date (calendar-gregorian-from-absolute day)) |
| 4757 | (setq s (concat | 5008 | (setq s (concat |
| 4758 | "Gregorian: " (calendar-date-string date) "\n" | 5009 | "Gregorian: " (calendar-date-string date) "\n" |
| 4759 | "ISO: " (calendar-iso-date-string date) "\n" | 5010 | "ISO: " (calendar-iso-date-string date) "\n" |
| 4760 | "Day of Yr: " (calendar-day-of-year-string date) "\n" | 5011 | "Day of Yr: " (calendar-day-of-year-string date) "\n" |
| @@ -4801,7 +5052,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4801 | (let (type path line (pos (point))) | 5052 | (let (type path line (pos (point))) |
| 4802 | (save-excursion | 5053 | (save-excursion |
| 4803 | (skip-chars-backward | 5054 | (skip-chars-backward |
| 4804 | (if org-allow-space-in-links "^\t\n\r" "^ \t\n\r")) | 5055 | (concat (if org-allow-space-in-links "^" "^ ") |
| 5056 | org-non-link-chars)) | ||
| 4805 | (if (re-search-forward | 5057 | (if (re-search-forward |
| 4806 | org-link-regexp | 5058 | org-link-regexp |
| 4807 | (save-excursion | 5059 | (save-excursion |
| @@ -4812,7 +5064,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4812 | (setq type (match-string 1) | 5064 | (setq type (match-string 1) |
| 4813 | path (match-string 2))) | 5065 | path (match-string 2))) |
| 4814 | (unless path | 5066 | (unless path |
| 4815 | (error "No link found.")) | 5067 | (error "No link found")) |
| 4816 | ;; Remove any trailing spaces in path | 5068 | ;; Remove any trailing spaces in path |
| 4817 | (if (string-match " +\\'" path) | 5069 | (if (string-match " +\\'" path) |
| 4818 | (setq path (replace-match "" t t path))) | 5070 | (setq path (replace-match "" t t path))) |
| @@ -4866,6 +5118,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4866 | 5118 | ||
| 4867 | ((string= type "shell") | 5119 | ((string= type "shell") |
| 4868 | (let ((cmd path)) | 5120 | (let ((cmd path)) |
| 5121 | (while (string-match "@{" cmd) | ||
| 5122 | (setq cmd (replace-match "<" t t cmd))) | ||
| 5123 | (while (string-match "@}" cmd) | ||
| 5124 | (setq cmd (replace-match ">" t t cmd))) | ||
| 4869 | (if (or (not org-confirm-shell-links) | 5125 | (if (or (not org-confirm-shell-links) |
| 4870 | (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd))) | 5126 | (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd))) |
| 4871 | (shell-command cmd) | 5127 | (shell-command cmd) |
| @@ -4961,7 +5217,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 4961 | (widen) | 5217 | (widen) |
| 4962 | (goto-char (point-max)) | 5218 | (goto-char (point-max)) |
| 4963 | (if (re-search-backward | 5219 | (if (re-search-backward |
| 4964 | (concat "^Message-ID:\\s-+" (regexp-quote | 5220 | (concat "^Message-ID:\\s-+" (regexp-quote |
| 4965 | (or article ""))) | 5221 | (or article ""))) |
| 4966 | nil t) | 5222 | nil t) |
| 4967 | (rmail-what-message)))))) | 5223 | (rmail-what-message)))))) |
| @@ -4997,7 +5253,7 @@ If the file does not exist, an error is thrown." | |||
| 4997 | (cdr (assoc t apps))))) | 5253 | (cdr (assoc t apps))))) |
| 4998 | (cond | 5254 | (cond |
| 4999 | ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) | 5255 | ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) |
| 5000 | (setq cmd (format cmd file)) | 5256 | (setq cmd (format cmd (concat "\"" file "\""))) |
| 5001 | (save-window-excursion | 5257 | (save-window-excursion |
| 5002 | (shell-command (concat cmd " & &")))) | 5258 | (shell-command (concat cmd " & &")))) |
| 5003 | ((or (stringp cmd) | 5259 | ((or (stringp cmd) |
| @@ -5043,10 +5299,12 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5043 | (cond | 5299 | (cond |
| 5044 | 5300 | ||
| 5045 | ((eq major-mode 'bbdb-mode) | 5301 | ((eq major-mode 'bbdb-mode) |
| 5046 | (setq link (concat "bbdb:" | 5302 | (setq cpltxt (concat |
| 5047 | (or (bbdb-record-name (bbdb-current-record)) | 5303 | "bbdb:" |
| 5048 | (bbdb-record-company (bbdb-current-record)))))) | 5304 | (or (bbdb-record-name (bbdb-current-record)) |
| 5049 | 5305 | (bbdb-record-company (bbdb-current-record)))) | |
| 5306 | link (org-make-link cpltxt))) | ||
| 5307 | |||
| 5050 | ((eq major-mode 'calendar-mode) | 5308 | ((eq major-mode 'calendar-mode) |
| 5051 | (let ((cd (calendar-cursor-to-date))) | 5309 | (let ((cd (calendar-cursor-to-date))) |
| 5052 | (setq link | 5310 | (setq link |
| @@ -5072,8 +5330,9 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5072 | folder) | 5330 | folder) |
| 5073 | (setq folder (replace-match "" t t folder))) | 5331 | (setq folder (replace-match "" t t folder))) |
| 5074 | (setq cpltxt (concat author " on: " subject)) | 5332 | (setq cpltxt (concat author " on: " subject)) |
| 5075 | (setq link (concat cpltxt "\n " "vm:" folder | 5333 | (setq link (concat cpltxt "\n " |
| 5076 | "#" message-id))))) | 5334 | (org-make-link |
| 5335 | "vm:" folder "#" message-id)))))) | ||
| 5077 | 5336 | ||
| 5078 | ((eq major-mode 'wl-summary-mode) | 5337 | ((eq major-mode 'wl-summary-mode) |
| 5079 | (let* ((msgnum (wl-summary-message-number)) | 5338 | (let* ((msgnum (wl-summary-message-number)) |
| @@ -5084,8 +5343,10 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5084 | (author (wl-summary-line-from)) ; FIXME: how to get author name? | 5343 | (author (wl-summary-line-from)) ; FIXME: how to get author name? |
| 5085 | (subject "???")) ; FIXME: How to get subject of email? | 5344 | (subject "???")) ; FIXME: How to get subject of email? |
| 5086 | (setq cpltxt (concat author " on: " subject)) | 5345 | (setq cpltxt (concat author " on: " subject)) |
| 5087 | (setq link (concat cpltxt "\n " "wl:" wl-summary-buffer-folder-name | 5346 | (setq link (concat cpltxt "\n " |
| 5088 | "#" message-id)))) | 5347 | (org-make-link |
| 5348 | "wl:" wl-summary-buffer-folder-name | ||
| 5349 | "#" message-id))))) | ||
| 5089 | 5350 | ||
| 5090 | ((eq major-mode 'rmail-mode) | 5351 | ((eq major-mode 'rmail-mode) |
| 5091 | (save-excursion | 5352 | (save-excursion |
| @@ -5096,8 +5357,9 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5096 | (author (mail-fetch-field "from")) | 5357 | (author (mail-fetch-field "from")) |
| 5097 | (subject (mail-fetch-field "subject"))) | 5358 | (subject (mail-fetch-field "subject"))) |
| 5098 | (setq cpltxt (concat author " on: " subject)) | 5359 | (setq cpltxt (concat author " on: " subject)) |
| 5099 | (setq link (concat cpltxt "\n " "rmail:" folder | 5360 | (setq link (concat cpltxt "\n " |
| 5100 | "#" message-id)))))) | 5361 | (org-make-link |
| 5362 | "rmail:" folder "#" message-id))))))) | ||
| 5101 | 5363 | ||
| 5102 | ((eq major-mode 'gnus-group-mode) | 5364 | ((eq major-mode 'gnus-group-mode) |
| 5103 | (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus | 5365 | (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus |
| @@ -5105,11 +5367,12 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5105 | ((fboundp 'gnus-group-name) | 5367 | ((fboundp 'gnus-group-name) |
| 5106 | (gnus-group-name)) | 5368 | (gnus-group-name)) |
| 5107 | (t "???")))) | 5369 | (t "???")))) |
| 5108 | (setq link (concat | 5370 | (setq cpltxt (concat |
| 5109 | (if (org-xor arg org-usenet-links-prefer-google) | 5371 | (if (org-xor arg org-usenet-links-prefer-google) |
| 5110 | "http://groups.google.com/groups?group=" | 5372 | "http://groups.google.com/groups?group=" |
| 5111 | "gnus:") | 5373 | "gnus:") |
| 5112 | group)))) | 5374 | group) |
| 5375 | link (org-make-link cpltxt)))) | ||
| 5113 | 5376 | ||
| 5114 | ((memq major-mode '(gnus-summary-mode gnus-article-mode)) | 5377 | ((memq major-mode '(gnus-summary-mode gnus-article-mode)) |
| 5115 | (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary)) | 5378 | (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary)) |
| @@ -5128,27 +5391,34 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5128 | cpltxt "\n " | 5391 | cpltxt "\n " |
| 5129 | (format "http://groups.google.com/groups?as_umsgid=%s" | 5392 | (format "http://groups.google.com/groups?as_umsgid=%s" |
| 5130 | (org-fixup-message-id-for-http message-id)))) | 5393 | (org-fixup-message-id-for-http message-id)))) |
| 5131 | (setq link (concat cpltxt "\n" "gnus:" group | 5394 | (setq link (concat cpltxt "\n" |
| 5132 | "#" (number-to-string article)))))) | 5395 | (org-make-link |
| 5396 | "gnus:" group | ||
| 5397 | "#" (number-to-string article))))))) | ||
| 5133 | 5398 | ||
| 5134 | ((eq major-mode 'w3-mode) | 5399 | ((eq major-mode 'w3-mode) |
| 5135 | (setq link (url-view-url t))) | 5400 | (setq cpltxt (url-view-url t) |
| 5401 | link (org-make-link cpltxt))) | ||
| 5136 | ((eq major-mode 'w3m-mode) | 5402 | ((eq major-mode 'w3m-mode) |
| 5137 | (setq link w3m-current-url)) | 5403 | (setq cpltxt w3m-current-url |
| 5404 | link (org-make-link cpltxt))) | ||
| 5138 | 5405 | ||
| 5139 | ((buffer-file-name) | 5406 | ((buffer-file-name) |
| 5140 | ;; Just link to this file here. | 5407 | ;; Just link to this file here. |
| 5141 | (setq link (concat "file:" | 5408 | (setq cpltxt (concat "file:" |
| 5142 | (abbreviate-file-name (buffer-file-name)))) | 5409 | (abbreviate-file-name (buffer-file-name)))) |
| 5143 | ;; Add the line number? | 5410 | ;; Add the line number? |
| 5144 | (if (org-xor org-line-numbers-in-file-links arg) | 5411 | (if (org-xor org-line-numbers-in-file-links arg) |
| 5145 | (setq link | 5412 | (setq cpltxt |
| 5146 | (concat link | 5413 | (concat cpltxt |
| 5147 | ":" (int-to-string | 5414 | ":" (int-to-string |
| 5148 | (+ (if (bolp) 1 0) (count-lines | 5415 | (+ (if (bolp) 1 0) (count-lines |
| 5149 | (point-min) (point)))))))) | 5416 | (point-min) (point))))))) |
| 5417 | (setq link (org-make-link cpltxt))) | ||
| 5418 | |||
| 5150 | ((interactive-p) | 5419 | ((interactive-p) |
| 5151 | (error "Cannot link to a buffer which is not visiting a file")) | 5420 | (error "Cannot link to a buffer which is not visiting a file")) |
| 5421 | |||
| 5152 | (t (setq link nil))) | 5422 | (t (setq link nil))) |
| 5153 | 5423 | ||
| 5154 | (if (and (interactive-p) link) | 5424 | (if (and (interactive-p) link) |
| @@ -5158,6 +5428,10 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5158 | (message "Stored: %s" (or cpltxt link))) | 5428 | (message "Stored: %s" (or cpltxt link))) |
| 5159 | link))) | 5429 | link))) |
| 5160 | 5430 | ||
| 5431 | (defun org-make-link (&rest strings) | ||
| 5432 | "Concatenate STRINGS, format resulting string with `org-link-format'." | ||
| 5433 | (format org-link-format (apply 'concat strings))) | ||
| 5434 | |||
| 5161 | (defun org-xor (a b) | 5435 | (defun org-xor (a b) |
| 5162 | "Exclusive or." | 5436 | "Exclusive or." |
| 5163 | (if a (not b) b)) | 5437 | (if a (not b) b)) |
| @@ -5202,7 +5476,8 @@ For file links, arg negates `org-line-numbers-in-file-links'." | |||
| 5202 | Completion can be used to select a link previously stored with | 5476 | Completion can be used to select a link previously stored with |
| 5203 | `org-store-link'. When the empty string is entered (i.e. if you just | 5477 | `org-store-link'. When the empty string is entered (i.e. if you just |
| 5204 | press RET at the prompt), the link defaults to the most recently | 5478 | press RET at the prompt), the link defaults to the most recently |
| 5205 | stored link. | 5479 | stored link. As SPC triggers completion in the minibuffer, you need to |
| 5480 | use M-SPC or C-q SPC to force the insertion of a space character. | ||
| 5206 | 5481 | ||
| 5207 | With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be | 5482 | With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be |
| 5208 | selected using completion. The path to the file will be relative to | 5483 | selected using completion. The path to the file will be relative to |
| @@ -5226,15 +5501,20 @@ is in the current directory or below." | |||
| 5226 | (let ((pwd (file-name-as-directory (expand-file-name ".")))) | 5501 | (let ((pwd (file-name-as-directory (expand-file-name ".")))) |
| 5227 | (cond | 5502 | (cond |
| 5228 | ((equal complete-file '(16)) | 5503 | ((equal complete-file '(16)) |
| 5229 | (insert "file:" (abbreviate-file-name (expand-file-name link)))) | 5504 | (insert |
| 5505 | (org-make-link | ||
| 5506 | "file:" (abbreviate-file-name (expand-file-name link))))) | ||
| 5230 | ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") | 5507 | ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") |
| 5231 | (expand-file-name link)) | 5508 | (expand-file-name link)) |
| 5232 | (insert "file:" (match-string 1 (expand-file-name link)))) | 5509 | (insert |
| 5233 | (t (insert "file:" link)))) | 5510 | (org-make-link |
| 5511 | "file:" (match-string 1 (expand-file-name link))))) | ||
| 5512 | (t (insert (org-make-link "file:" link))))) | ||
| 5234 | (setq linktxt (cdr (assoc link org-stored-links))) | 5513 | (setq linktxt (cdr (assoc link org-stored-links))) |
| 5235 | (if (not org-keep-stored-link-after-insertion) | 5514 | (if (not org-keep-stored-link-after-insertion) |
| 5236 | (setq org-stored-links (delq (assoc link org-stored-links) | 5515 | (setq org-stored-links (delq (assoc link org-stored-links) |
| 5237 | org-stored-links))) | 5516 | org-stored-links))) |
| 5517 | (if (not linktxt) (setq link (org-make-link link))) | ||
| 5238 | (let ((lines (org-split-string (or linktxt link) "\n"))) | 5518 | (let ((lines (org-split-string (or linktxt link) "\n"))) |
| 5239 | (insert (car lines)) | 5519 | (insert (car lines)) |
| 5240 | (setq matched (string-match org-link-regexp (car lines))) | 5520 | (setq matched (string-match org-link-regexp (car lines))) |
| @@ -5301,7 +5581,7 @@ If the variable `org-adapt-indentation' is non-nil, the entire text is | |||
| 5301 | also indented so that it starts in the same column as the headline | 5581 | also indented so that it starts in the same column as the headline |
| 5302 | \(i.e. after the stars). | 5582 | \(i.e. after the stars). |
| 5303 | 5583 | ||
| 5304 | See also the variable `org-reverse-note-order'." | 5584 | See also the variable `org-reverse-note-order'." |
| 5305 | (catch 'quit | 5585 | (catch 'quit |
| 5306 | (let* ((txt (buffer-substring (point-min) (point-max))) | 5586 | (let* ((txt (buffer-substring (point-min) (point-max))) |
| 5307 | (fastp current-prefix-arg) | 5587 | (fastp current-prefix-arg) |
| @@ -5791,7 +6071,7 @@ If the field at the cursor is empty, copy into it the content of the nearest | |||
| 5791 | non-empty field above. With argument N, use the Nth non-empty field. | 6071 | non-empty field above. With argument N, use the Nth non-empty field. |
| 5792 | If the current field is not empty, it is copied down to the next row, and | 6072 | If the current field is not empty, it is copied down to the next row, and |
| 5793 | the cursor is moved with it. Therefore, repeating this command causes the | 6073 | the cursor is moved with it. Therefore, repeating this command causes the |
| 5794 | column to be filled row-by-row. | 6074 | column to be filled row-by-row. |
| 5795 | If the variable `org-table-copy-increment' is non-nil and the field is an | 6075 | If the variable `org-table-copy-increment' is non-nil and the field is an |
| 5796 | integer, it will be incremented while copying." | 6076 | integer, it will be incremented while copying." |
| 5797 | (interactive "p") | 6077 | (interactive "p") |
| @@ -5882,7 +6162,7 @@ When called interactively, column is also displayed in echo area." | |||
| 5882 | (defun org-table-goto-column (n &optional on-delim force) | 6162 | (defun org-table-goto-column (n &optional on-delim force) |
| 5883 | "Move the cursor to the Nth column in the current table line. | 6163 | "Move the cursor to the Nth column in the current table line. |
| 5884 | With optional argument ON-DELIM, stop with point before the left delimiter | 6164 | With optional argument ON-DELIM, stop with point before the left delimiter |
| 5885 | of the field. | 6165 | of the field. |
| 5886 | If there are less than N fields, just go to after the last delimiter. | 6166 | If there are less than N fields, just go to after the last delimiter. |
| 5887 | However, when FORCE is non-nil, create new columns if necessary." | 6167 | However, when FORCE is non-nil, create new columns if necessary." |
| 5888 | (let ((pos (point-at-eol))) | 6168 | (let ((pos (point-at-eol))) |
| @@ -5902,7 +6182,8 @@ However, when FORCE is non-nil, create new columns if necessary." | |||
| 5902 | (if (looking-at " ") (forward-char 1)))))) | 6182 | (if (looking-at " ") (forward-char 1)))))) |
| 5903 | 6183 | ||
| 5904 | (defun org-at-table-p (&optional table-type) | 6184 | (defun org-at-table-p (&optional table-type) |
| 5905 | "Return t if the cursor is inside an org-type table." | 6185 | "Return t if the cursor is inside an org-type table. |
| 6186 | If TABLE-TYPE is non-nil, also chack for table.el-type tables." | ||
| 5906 | (if org-enable-table-editor | 6187 | (if org-enable-table-editor |
| 5907 | (save-excursion | 6188 | (save-excursion |
| 5908 | (beginning-of-line 1) | 6189 | (beginning-of-line 1) |
| @@ -6082,7 +6363,7 @@ However, when FORCE is non-nil, create new columns if necessary." | |||
| 6082 | (if (not (org-at-table-p)) | 6363 | (if (not (org-at-table-p)) |
| 6083 | (progn | 6364 | (progn |
| 6084 | (goto-char pos) | 6365 | (goto-char pos) |
| 6085 | (error "Cannot move row further."))) | 6366 | (error "Cannot move row further"))) |
| 6086 | (goto-char pos) | 6367 | (goto-char pos) |
| 6087 | (beginning-of-line 1) | 6368 | (beginning-of-line 1) |
| 6088 | (setq pos (point)) | 6369 | (setq pos (point)) |
| @@ -6169,7 +6450,7 @@ with `org-table-paste-rectangle'" | |||
| 6169 | (goto-char beg) | 6450 | (goto-char beg) |
| 6170 | (org-table-check-inside-data-field) | 6451 | (org-table-check-inside-data-field) |
| 6171 | (setq l01 (count-lines (point-min) (point)) | 6452 | (setq l01 (count-lines (point-min) (point)) |
| 6172 | c01 (org-table-current-column)) | 6453 | c01 (org-table-current-column)) |
| 6173 | (goto-char end) | 6454 | (goto-char end) |
| 6174 | (org-table-check-inside-data-field) | 6455 | (org-table-check-inside-data-field) |
| 6175 | (setq l02 (count-lines (point-min) (point)) | 6456 | (setq l02 (count-lines (point-min) (point)) |
| @@ -6190,7 +6471,7 @@ with `org-table-paste-rectangle'" | |||
| 6190 | (setq l1 (1+ l1))))) | 6471 | (setq l1 (1+ l1))))) |
| 6191 | (setq org-table-clip (nreverse region)) | 6472 | (setq org-table-clip (nreverse region)) |
| 6192 | (if cut (org-table-align)))) | 6473 | (if cut (org-table-align)))) |
| 6193 | 6474 | ||
| 6194 | (defun org-table-paste-rectangle () | 6475 | (defun org-table-paste-rectangle () |
| 6195 | "Paste a rectangular region into a table. | 6476 | "Paste a rectangular region into a table. |
| 6196 | The upper right corner ends up in the current field. All involved fields | 6477 | The upper right corner ends up in the current field. All involved fields |
| @@ -6301,7 +6582,7 @@ blank, and the content is appended to the field above." | |||
| 6301 | (+ (length org-table-clip) arg) | 6582 | (+ (length org-table-clip) arg) |
| 6302 | arg) | 6583 | arg) |
| 6303 | (length org-table-clip))) | 6584 | (length org-table-clip))) |
| 6304 | (setq org-table-clip | 6585 | (setq org-table-clip |
| 6305 | (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ") | 6586 | (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ") |
| 6306 | nil nlines))) | 6587 | nil nlines))) |
| 6307 | (goto-char beg) | 6588 | (goto-char beg) |
| @@ -6356,7 +6637,7 @@ The return value is a list of lines, without newlines at the end." | |||
| 6356 | (setq ll (org-do-wrap words w))) | 6637 | (setq ll (org-do-wrap words w))) |
| 6357 | ll)) | 6638 | ll)) |
| 6358 | (t (error "Cannot wrap this"))))) | 6639 | (t (error "Cannot wrap this"))))) |
| 6359 | 6640 | ||
| 6360 | 6641 | ||
| 6361 | (defun org-do-wrap (words width) | 6642 | (defun org-do-wrap (words width) |
| 6362 | "Create lines of maximum width WIDTH (in characters) from word list WORDS." | 6643 | "Create lines of maximum width WIDTH (in characters) from word list WORDS." |
| @@ -6681,28 +6962,32 @@ table editor in arbitrary modes.") | |||
| 6681 | 6962 | ||
| 6682 | ;;;###autoload | 6963 | ;;;###autoload |
| 6683 | (defun orgtbl-mode (&optional arg) | 6964 | (defun orgtbl-mode (&optional arg) |
| 6684 | "The `org-mode' table editor as a minor mode for use in other modes." | 6965 | "The `org-mode' table editor as a minor mode for use in other modes." |
| 6685 | (interactive) | 6966 | (interactive) |
| 6686 | (setq orgtbl-mode | 6967 | (if (eq major-mode 'org-mode) |
| 6687 | (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) | 6968 | ;; Exit without error, in case some hook functions calls this |
| 6688 | (if orgtbl-mode | 6969 | ;; by accident in org-mode. |
| 6689 | (progn | 6970 | (message "Orgtbl-mode is not useful in org-mode, command ignored") |
| 6690 | (set (make-local-variable (quote org-table-may-need-update)) t) | 6971 | (setq orgtbl-mode |
| 6691 | (make-local-hook (quote before-change-functions)) | 6972 | (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) |
| 6692 | (add-hook 'before-change-functions 'org-before-change-function | 6973 | (if orgtbl-mode |
| 6693 | nil 'local) | 6974 | (progn |
| 6694 | (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) | 6975 | (set (make-local-variable (quote org-table-may-need-update)) t) |
| 6695 | auto-fill-inhibit-regexp) | 6976 | (make-local-hook (quote before-change-functions)) |
| 6696 | (set (make-local-variable 'auto-fill-inhibit-regexp) | 6977 | (add-hook 'before-change-functions 'org-before-change-function |
| 6697 | (if auto-fill-inhibit-regexp | 6978 | nil 'local) |
| 6698 | (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) | 6979 | (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) |
| 6699 | "[ \t]*|")) | 6980 | auto-fill-inhibit-regexp) |
| 6700 | (easy-menu-add orgtbl-mode-menu) | 6981 | (set (make-local-variable 'auto-fill-inhibit-regexp) |
| 6701 | (run-hooks 'orgtbl-mode-hook)) | 6982 | (if auto-fill-inhibit-regexp |
| 6702 | (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) | 6983 | (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) |
| 6703 | (remove-hook 'before-change-functions 'org-before-change-function t) | 6984 | "[ \t]*|")) |
| 6704 | (easy-menu-remove orgtbl-mode-menu) | 6985 | (easy-menu-add orgtbl-mode-menu) |
| 6705 | (force-mode-line-update 'all))) | 6986 | (run-hooks 'orgtbl-mode-hook)) |
| 6987 | (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) | ||
| 6988 | (remove-hook 'before-change-functions 'org-before-change-function t) | ||
| 6989 | (easy-menu-remove orgtbl-mode-menu) | ||
| 6990 | (force-mode-line-update 'all)))) | ||
| 6706 | 6991 | ||
| 6707 | ;; Install it as a minor mode. | 6992 | ;; Install it as a minor mode. |
| 6708 | (put 'orgtbl-mode :included t) | 6993 | (put 'orgtbl-mode :included t) |
| @@ -6711,7 +6996,9 @@ table editor in arbitrary modes.") | |||
| 6711 | 6996 | ||
| 6712 | (defun orgtbl-make-binding (fun &rest keys) | 6997 | (defun orgtbl-make-binding (fun &rest keys) |
| 6713 | "Create a function for binding in the table minor mode." | 6998 | "Create a function for binding in the table minor mode." |
| 6714 | (list 'lambda '(arg) '(interactive "p") | 6999 | (list 'lambda '(arg) |
| 7000 | (concat "Run `" (symbol-name fun) "' or the default binding.") | ||
| 7001 | '(interactive "p") | ||
| 6715 | (list 'if | 7002 | (list 'if |
| 6716 | '(org-at-table-p) | 7003 | '(org-at-table-p) |
| 6717 | (list 'call-interactively (list 'quote fun)) | 7004 | (list 'call-interactively (list 'quote fun)) |
| @@ -6730,29 +7017,30 @@ table editor in arbitrary modes.") | |||
| 6730 | 7017 | ||
| 6731 | ;; Keybindings for the minor mode | 7018 | ;; Keybindings for the minor mode |
| 6732 | (let ((bindings | 7019 | (let ((bindings |
| 6733 | '(([(meta shift left)] org-table-delete-column) | 7020 | (list |
| 6734 | ([(meta left)] org-table-move-column-left) | 7021 | '([(meta shift left)] org-table-delete-column) |
| 6735 | ([(meta right)] org-table-move-column-right) | 7022 | '([(meta left)] org-table-move-column-left) |
| 6736 | ([(meta shift right)] org-table-insert-column) | 7023 | '([(meta right)] org-table-move-column-right) |
| 6737 | ([(meta shift up)] org-table-kill-row) | 7024 | '([(meta shift right)] org-table-insert-column) |
| 6738 | ([(meta shift down)] org-table-insert-row) | 7025 | '([(meta shift up)] org-table-kill-row) |
| 6739 | ([(meta up)] org-table-move-row-up) | 7026 | '([(meta shift down)] org-table-insert-row) |
| 6740 | ([(meta down)] org-table-move-row-down) | 7027 | '([(meta up)] org-table-move-row-up) |
| 6741 | ("\C-c\C-w" org-table-cut-region) | 7028 | '([(meta down)] org-table-move-row-down) |
| 6742 | ("\C-c\M-w" org-table-copy-region) | 7029 | '("\C-c\C-w" org-table-cut-region) |
| 6743 | ("\C-c\C-y" org-table-paste-rectangle) | 7030 | '("\C-c\M-w" org-table-copy-region) |
| 6744 | ("\C-c-" org-table-insert-hline) | 7031 | '("\C-c\C-y" org-table-paste-rectangle) |
| 6745 | ([(shift tab)] org-table-previous-field) | 7032 | '("\C-c-" org-table-insert-hline) |
| 6746 | ("\C-c\C-c" org-table-align) | 7033 | '([(shift tab)] org-table-previous-field) |
| 6747 | ([(return)] org-table-next-row) | 7034 | '("\C-c\C-c" org-table-align) |
| 6748 | ([(shift return)] org-table-copy-down) | 7035 | '("\C-m" org-table-next-row) |
| 6749 | ([(meta return)] org-table-wrap-region) | 7036 | (list (org-key 'S-return) 'org-table-copy-down) |
| 6750 | ("\C-c\C-q" org-table-wrap-region) | 7037 | '([(meta return)] org-table-wrap-region) |
| 6751 | ("\C-c?" org-table-current-column) | 7038 | '("\C-c\C-q" org-table-wrap-region) |
| 6752 | ("\C-c " org-table-blank-field) | 7039 | '("\C-c?" org-table-current-column) |
| 6753 | ("\C-c+" org-table-sum) | 7040 | '("\C-c " org-table-blank-field) |
| 6754 | ("\C-c|" org-table-toggle-vline-visibility) | 7041 | '("\C-c+" org-table-sum) |
| 6755 | ("\C-c=" org-table-eval-formula))) | 7042 | '("\C-c|" org-table-toggle-vline-visibility) |
| 7043 | '("\C-c=" org-table-eval-formula))) | ||
| 6756 | elt key fun cmd) | 7044 | elt key fun cmd) |
| 6757 | (while (setq elt (pop bindings)) | 7045 | (while (setq elt (pop bindings)) |
| 6758 | (setq key (car elt) | 7046 | (setq key (car elt) |
| @@ -6761,20 +7049,12 @@ table editor in arbitrary modes.") | |||
| 6761 | (define-key orgtbl-mode-map key cmd))) | 7049 | (define-key orgtbl-mode-map key cmd))) |
| 6762 | 7050 | ||
| 6763 | ;; Special treatment needed for TAB and RET | 7051 | ;; Special treatment needed for TAB and RET |
| 6764 | ;(define-key orgtbl-mode-map [(return)] | 7052 | |
| 6765 | ; (orgtbl-make-binding 'org-table-next-row [(return)] "\C-m")) | 7053 | (define-key orgtbl-mode-map [(return)] |
| 6766 | ;(define-key orgtbl-mode-map "\C-m" | ||
| 6767 | ; (orgtbl-make-binding 'org-table-next-row "\C-m" [(return)])) | ||
| 6768 | ;(define-key orgtbl-mode-map [(tab)] | ||
| 6769 | ; (orgtbl-make-binding 'org-table-next-field [(tab)] "\C-i")) | ||
| 6770 | ;(define-key orgtbl-mode-map "\C-i" | ||
| 6771 | ; (orgtbl-make-binding 'org-table-next-field "\C-i" [(tab)])) | ||
| 6772 | |||
| 6773 | (define-key orgtbl-mode-map [(return)] | ||
| 6774 | (orgtbl-make-binding 'orgtbl-ret [(return)] "\C-m")) | 7054 | (orgtbl-make-binding 'orgtbl-ret [(return)] "\C-m")) |
| 6775 | (define-key orgtbl-mode-map "\C-m" | 7055 | (define-key orgtbl-mode-map "\C-m" |
| 6776 | (orgtbl-make-binding 'orgtbl-ret "\C-m" [(return)])) | 7056 | (orgtbl-make-binding 'orgtbl-ret "\C-m" [(return)])) |
| 6777 | (define-key orgtbl-mode-map [(tab)] | 7057 | (define-key orgtbl-mode-map [(tab)] |
| 6778 | (orgtbl-make-binding 'orgtbl-tab [(tab)] "\C-i")) | 7058 | (orgtbl-make-binding 'orgtbl-tab [(tab)] "\C-i")) |
| 6779 | (define-key orgtbl-mode-map "\C-i" | 7059 | (define-key orgtbl-mode-map "\C-i" |
| 6780 | (orgtbl-make-binding 'orgtbl-tab "\C-i" [(tab)])) | 7060 | (orgtbl-make-binding 'orgtbl-tab "\C-i" [(tab)])) |
| @@ -6884,7 +7164,7 @@ a reduced column width." | |||
| 6884 | ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p) :keys "C-c C-q"]) | 7164 | ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p) :keys "C-c C-q"]) |
| 6885 | "--" | 7165 | "--" |
| 6886 | ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"] | 7166 | ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"] |
| 6887 | ["Sum Column/Rectangle" org-table-sum | 7167 | ["Sum Column/Rectangle" org-table-sum |
| 6888 | :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"] | 7168 | :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"] |
| 6889 | ["Eval Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="] | 7169 | ["Eval Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="] |
| 6890 | )) | 7170 | )) |
| @@ -7396,9 +7676,10 @@ and all options lines." | |||
| 7396 | (let* ((filename (concat (file-name-sans-extension (buffer-file-name)) | 7676 | (let* ((filename (concat (file-name-sans-extension (buffer-file-name)) |
| 7397 | ".txt")) | 7677 | ".txt")) |
| 7398 | (buffer (find-file-noselect filename)) | 7678 | (buffer (find-file-noselect filename)) |
| 7399 | (ore (concat | 7679 | (ore (concat |
| 7400 | (org-make-options-regexp | 7680 | (org-make-options-regexp |
| 7401 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP" | 7681 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" |
| 7682 | "STARTUP" "ARCHIVE" | ||
| 7402 | "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) | 7683 | "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) |
| 7403 | (if org-noutline-p "\\(\n\\|$\\)" ""))) | 7684 | (if org-noutline-p "\\(\n\\|$\\)" ""))) |
| 7404 | s e) | 7685 | s e) |
| @@ -7453,6 +7734,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 7453 | #+SEQ_TODO: %s | 7734 | #+SEQ_TODO: %s |
| 7454 | #+TYP_TODO: %s | 7735 | #+TYP_TODO: %s |
| 7455 | #+STARTUP: %s %s | 7736 | #+STARTUP: %s %s |
| 7737 | #+ARCHIVE: %s | ||
| 7456 | " | 7738 | " |
| 7457 | (buffer-name) (user-full-name) user-mail-address org-export-default-language | 7739 | (buffer-name) (user-full-name) user-mail-address org-export-default-language |
| 7458 | org-export-headline-levels | 7740 | org-export-headline-levels |
| @@ -7475,6 +7757,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 7475 | (cdr (assoc org-startup-folded | 7757 | (cdr (assoc org-startup-folded |
| 7476 | '((nil . "nofold")(t . "fold")(content . "content")))) | 7758 | '((nil . "nofold")(t . "fold")(content . "content")))) |
| 7477 | (if org-startup-with-deadline-check "dlcheck" "nodlcheck") | 7759 | (if org-startup-with-deadline-check "dlcheck" "nodlcheck") |
| 7760 | org-archive-location | ||
| 7478 | )) | 7761 | )) |
| 7479 | 7762 | ||
| 7480 | (defun org-insert-export-options-template () | 7763 | (defun org-insert-export-options-template () |
| @@ -7571,6 +7854,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7571 | (text nil) | 7854 | (text nil) |
| 7572 | (lang-words nil) | 7855 | (lang-words nil) |
| 7573 | (head-count 0) cnt | 7856 | (head-count 0) cnt |
| 7857 | (start 0) | ||
| 7574 | table-open type | 7858 | table-open type |
| 7575 | table-buffer table-orig-buffer | 7859 | table-buffer table-orig-buffer |
| 7576 | ) | 7860 | ) |
| @@ -7624,7 +7908,7 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7624 | ;; This is a headline | 7908 | ;; This is a headline |
| 7625 | (progn | 7909 | (progn |
| 7626 | (setq level (- (match-end 1) (match-beginning 1)) | 7910 | (setq level (- (match-end 1) (match-beginning 1)) |
| 7627 | txt (save-match-data | 7911 | txt (save-match-data |
| 7628 | (org-html-expand | 7912 | (org-html-expand |
| 7629 | (match-string 3 line))) | 7913 | (match-string 3 line))) |
| 7630 | todo | 7914 | todo |
| @@ -7668,8 +7952,15 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7668 | )) | 7952 | )) |
| 7669 | (setq head-count 0) | 7953 | (setq head-count 0) |
| 7670 | (org-init-section-numbers) | 7954 | (org-init-section-numbers) |
| 7671 | |||
| 7672 | (while (setq line (pop lines) origline line) | 7955 | (while (setq line (pop lines) origline line) |
| 7956 | ;; Protect the links | ||
| 7957 | (setq start 0) | ||
| 7958 | (while (string-match org-link-maybe-angles-regexp line start) | ||
| 7959 | (setq start (match-end 0)) | ||
| 7960 | (setq line (replace-match | ||
| 7961 | (concat "\000" (match-string 1 line) "\000") | ||
| 7962 | t t line))) | ||
| 7963 | |||
| 7673 | ;; replace "<" and ">" by "<" and ">" | 7964 | ;; replace "<" and ">" by "<" and ">" |
| 7674 | ;; handle @<..> HTML tags (replace "@>..<" by "<..>") | 7965 | ;; handle @<..> HTML tags (replace "@>..<" by "<..>") |
| 7675 | (setq line (org-html-expand line)) | 7966 | (setq line (org-html-expand line)) |
| @@ -7687,27 +7978,34 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7687 | (not (string-match "^[ \t]+\\(:.*\\)" | 7978 | (not (string-match "^[ \t]+\\(:.*\\)" |
| 7688 | (car lines)))) | 7979 | (car lines)))) |
| 7689 | "<br>\n" "\n")))) | 7980 | "<br>\n" "\n")))) |
| 7690 | 7981 | (setq start 0) | |
| 7691 | (when (string-match org-link-regexp line) | 7982 | (while (string-match org-protected-link-regexp line start) |
| 7983 | (setq start (- (match-end 0) 2)) | ||
| 7692 | (setq type (match-string 1 line)) | 7984 | (setq type (match-string 1 line)) |
| 7693 | (cond | 7985 | (cond |
| 7694 | ((member type '("http" "https" "ftp" "mailto" "news")) | 7986 | ((member type '("http" "https" "ftp" "mailto" "news")) |
| 7695 | ;; standard URL | 7987 | ;; standard URL |
| 7696 | (setq line (replace-match | 7988 | (setq line (replace-match |
| 7697 | "<a href=\"\\1:\\2\"><\\1:\\2></a>" | 7989 | ; "<a href=\"\\1:\\2\"><\\1:\\2></a>" |
| 7990 | "<a href=\"\\1:\\2\">\\1:\\2</a>" | ||
| 7698 | nil nil line))) | 7991 | nil nil line))) |
| 7699 | ((string= type "file") | 7992 | ((string= type "file") |
| 7700 | ;; FILE link | 7993 | ;; FILE link |
| 7701 | |||
| 7702 | (let* ((filename (match-string 2 line)) | 7994 | (let* ((filename (match-string 2 line)) |
| 7995 | (abs-p (file-name-absolute-p filename)) | ||
| 7996 | (thefile (if abs-p (expand-file-name filename) filename)) | ||
| 7997 | (thefile (save-match-data | ||
| 7998 | (if (string-match ":[0-9]+$" thefile) | ||
| 7999 | (replace-match "" t t thefile) | ||
| 8000 | thefile))) | ||
| 7703 | (file-is-image-p | 8001 | (file-is-image-p |
| 7704 | (save-match-data | 8002 | (save-match-data |
| 7705 | (string-match (org-image-file-name-regexp) filename)))) | 8003 | (string-match (org-image-file-name-regexp) thefile)))) |
| 7706 | (setq line (replace-match | 8004 | (setq line (replace-match |
| 7707 | (if (and org-export-html-inline-images | 8005 | (if (and org-export-html-inline-images |
| 7708 | file-is-image-p) | 8006 | file-is-image-p) |
| 7709 | "<img src=\"\\2\"/>" | 8007 | (concat "<img src=\"" thefile "\"/>") |
| 7710 | "<a href=\"\\2\">\\1:\\2</a>") | 8008 | (concat "<a href=\"" thefile "\">\\1:\\2</a>")) |
| 7711 | nil nil line)))) | 8009 | nil nil line)))) |
| 7712 | 8010 | ||
| 7713 | ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell")) | 8011 | ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell")) |
| @@ -7805,20 +8103,15 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7805 | (let ((head (and org-export-highlight-first-table-line | 8103 | (let ((head (and org-export-highlight-first-table-line |
| 7806 | (delq nil (mapcar | 8104 | (delq nil (mapcar |
| 7807 | (lambda (x) (string-match "^[ \t]*|-" x)) | 8105 | (lambda (x) (string-match "^[ \t]*|-" x)) |
| 7808 | lines)))) | 8106 | (cdr lines))))) |
| 7809 | lastline line fields html empty) | 8107 | line fields html) |
| 7810 | (setq html (concat org-export-html-table-tag "\n")) | 8108 | (setq html (concat org-export-html-table-tag "\n")) |
| 7811 | (while (setq lastline line | 8109 | (while (setq line (pop lines)) |
| 7812 | line (pop lines)) | ||
| 7813 | (setq empty " ") | ||
| 7814 | (catch 'next-line | 8110 | (catch 'next-line |
| 7815 | (if (string-match "^[ \t]*|-" line) | 8111 | (if (string-match "^[ \t]*|-" line) |
| 7816 | (if lastline | 8112 | (progn |
| 7817 | ;; A hline: simulate an empty table row instead. | 8113 | (setq head nil) ;; head ends here, first time around |
| 7818 | (setq line (org-fake-empty-table-line lastline) | 8114 | ;; ignore this line |
| 7819 | head nil | ||
| 7820 | empty "") | ||
| 7821 | ;; Ignore this line | ||
| 7822 | (throw 'next-line t))) | 8115 | (throw 'next-line t))) |
| 7823 | ;; Break the line into fields | 8116 | ;; Break the line into fields |
| 7824 | (setq fields (org-split-string line "[ \t]*|[ \t]*")) | 8117 | (setq fields (org-split-string line "[ \t]*|[ \t]*")) |
| @@ -7826,7 +8119,6 @@ headlines. The default is 3. Lower levels will become bulleted lists." | |||
| 7826 | html | 8119 | html |
| 7827 | "<tr>" | 8120 | "<tr>" |
| 7828 | (mapconcat (lambda (x) | 8121 | (mapconcat (lambda (x) |
| 7829 | (if (equal x "") (setq x empty)) | ||
| 7830 | (if head | 8122 | (if head |
| 7831 | (concat "<th>" x "</th>") | 8123 | (concat "<th>" x "</th>") |
| 7832 | (concat "<td valign=\"top\">" x "</td>"))) | 8124 | (concat "<td valign=\"top\">" x "</td>"))) |
| @@ -7899,7 +8191,7 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 7899 | (insert (mapconcat 'identity lines "\n")) | 8191 | (insert (mapconcat 'identity lines "\n")) |
| 7900 | (goto-char (point-min)) | 8192 | (goto-char (point-min)) |
| 7901 | (if (not (re-search-forward "|[^+]" nil t)) | 8193 | (if (not (re-search-forward "|[^+]" nil t)) |
| 7902 | (error "Error processing table.")) | 8194 | (error "Error processing table")) |
| 7903 | (table-recognize-table) | 8195 | (table-recognize-table) |
| 7904 | (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) | 8196 | (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) |
| 7905 | (table-generate-source 'html " org-tmp2 ") | 8197 | (table-generate-source 'html " org-tmp2 ") |
| @@ -7915,9 +8207,9 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 7915 | (r (if m (substring string m) ""))) | 8207 | (r (if m (substring string m) ""))) |
| 7916 | ;; convert < to < and > to > | 8208 | ;; convert < to < and > to > |
| 7917 | (while (string-match "<" s) | 8209 | (while (string-match "<" s) |
| 7918 | (setq s (replace-match "<" nil nil s))) | 8210 | (setq s (replace-match "<" t t s))) |
| 7919 | (while (string-match ">" s) | 8211 | (while (string-match ">" s) |
| 7920 | (setq s (replace-match ">" nil nil s))) | 8212 | (setq s (replace-match ">" t t s))) |
| 7921 | (if org-export-html-expand | 8213 | (if org-export-html-expand |
| 7922 | (while (string-match "@<\\([^&]*\\)>" s) | 8214 | (while (string-match "@<\\([^&]*\\)>" s) |
| 7923 | (setq s (replace-match "<\\1>" nil nil s)))) | 8215 | (setq s (replace-match "<\\1>" nil nil s)))) |
| @@ -8126,7 +8418,6 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 8126 | ;; i k @ expendable from outline-mode | 8418 | ;; i k @ expendable from outline-mode |
| 8127 | ;; 0123456789 ! $%^& * ()_{} " ~`' free | 8419 | ;; 0123456789 ! $%^& * ()_{} " ~`' free |
| 8128 | 8420 | ||
| 8129 | (define-key org-mode-map [(tab)] 'org-cycle) | ||
| 8130 | (define-key org-mode-map "\C-i" 'org-cycle) | 8421 | (define-key org-mode-map "\C-i" 'org-cycle) |
| 8131 | (define-key org-mode-map [(meta tab)] 'org-complete) | 8422 | (define-key org-mode-map [(meta tab)] 'org-complete) |
| 8132 | (define-key org-mode-map "\M-\C-i" 'org-complete) | 8423 | (define-key org-mode-map "\M-\C-i" 'org-complete) |
| @@ -8144,6 +8435,7 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 8144 | (define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special) | 8435 | (define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special) |
| 8145 | (define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special) | 8436 | (define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special) |
| 8146 | (define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special) | 8437 | (define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special) |
| 8438 | (define-key org-mode-map "\C-c$" 'org-archive-subtree) | ||
| 8147 | (define-key org-mode-map "\C-c\C-j" 'org-goto) | 8439 | (define-key org-mode-map "\C-c\C-j" 'org-goto) |
| 8148 | (define-key org-mode-map "\C-c\C-t" 'org-todo) | 8440 | (define-key org-mode-map "\C-c\C-t" 'org-todo) |
| 8149 | (define-key org-mode-map "\C-c\C-s" 'org-schedule) | 8441 | (define-key org-mode-map "\C-c\C-s" 'org-schedule) |
| @@ -8166,21 +8458,19 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 8166 | (define-key org-mode-map "\C-c[" 'org-add-file) | 8458 | (define-key org-mode-map "\C-c[" 'org-add-file) |
| 8167 | (define-key org-mode-map "\C-c]" 'org-remove-file) | 8459 | (define-key org-mode-map "\C-c]" 'org-remove-file) |
| 8168 | (define-key org-mode-map "\C-c\C-r" 'org-timeline) | 8460 | (define-key org-mode-map "\C-c\C-r" 'org-timeline) |
| 8169 | (define-key org-mode-map [(shift up)] 'org-shiftup) | 8461 | (define-key org-mode-map (org-key 'S-up) 'org-shiftup) |
| 8170 | (define-key org-mode-map [(shift down)] 'org-shiftdown) | 8462 | (define-key org-mode-map (org-key 'S-down) 'org-shiftdown) |
| 8171 | (define-key org-mode-map [(shift left)] 'org-timestamp-down-day) | 8463 | (define-key org-mode-map (org-key 'S-left) 'org-timestamp-down-day) |
| 8172 | (define-key org-mode-map [(shift right)] 'org-timestamp-up-day) | 8464 | (define-key org-mode-map (org-key 'S-right) 'org-timestamp-up-day) |
| 8173 | (define-key org-mode-map "\C-c-" 'org-table-insert-hline) | 8465 | (define-key org-mode-map "\C-c-" 'org-table-insert-hline) |
| 8174 | ;; The following line is e.g. necessary for German keyboards under Suse Linux | 8466 | ;; The following line is e.g. necessary for German keyboards under Suse Linux |
| 8175 | (unless org-xemacs-p | 8467 | (unless org-xemacs-p |
| 8176 | (define-key org-mode-map [S-iso-lefttab] 'org-shifttab)) | 8468 | (define-key org-mode-map [S-iso-lefttab] 'org-shifttab)) |
| 8177 | (define-key org-mode-map [(shift tab)] 'org-shifttab) | 8469 | (define-key org-mode-map [(shift tab)] 'org-shifttab) |
| 8178 | (define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) | 8470 | (define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) |
| 8179 | (define-key org-mode-map [(return)] 'org-return) | 8471 | (define-key org-mode-map "\C-m" 'org-return) |
| 8180 | (define-key org-mode-map [(shift return)] 'org-table-copy-down) | 8472 | (define-key org-mode-map (org-key 'S-return) 'org-table-copy-down) |
| 8181 | (define-key org-mode-map [(meta return)] 'org-meta-return) | 8473 | (define-key org-mode-map [(meta return)] 'org-meta-return) |
| 8182 | (define-key org-mode-map [(control up)] 'org-move-line-up) | ||
| 8183 | (define-key org-mode-map [(control down)] 'org-move-line-down) | ||
| 8184 | (define-key org-mode-map "\C-c?" 'org-table-current-column) | 8474 | (define-key org-mode-map "\C-c?" 'org-table-current-column) |
| 8185 | (define-key org-mode-map "\C-c " 'org-table-blank-field) | 8475 | (define-key org-mode-map "\C-c " 'org-table-blank-field) |
| 8186 | (define-key org-mode-map "\C-c+" 'org-table-sum) | 8476 | (define-key org-mode-map "\C-c+" 'org-table-sum) |
| @@ -8199,15 +8489,12 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 8199 | (define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) | 8489 | (define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) |
| 8200 | (define-key org-mode-map "\C-c\C-x\C-h" 'org-export-as-html-and-open) | 8490 | (define-key org-mode-map "\C-c\C-x\C-h" 'org-export-as-html-and-open) |
| 8201 | 8491 | ||
| 8202 | |||
| 8203 | ;; FIXME: Do we really need to save match data in these commands? | ||
| 8204 | ;; I would like to remove it in order to minimize impact. | ||
| 8205 | ;; Self-insert already does not preserve it. How much resources used by this??? | ||
| 8206 | |||
| 8207 | (defsubst org-table-p () | 8492 | (defsubst org-table-p () |
| 8208 | (if (and (eq major-mode 'org-mode) font-lock-mode) | 8493 | (if (and (eq major-mode 'org-mode) font-lock-mode) |
| 8209 | (eq (get-text-property (point) 'face) 'org-table-face) | 8494 | (eq (get-text-property (point) 'face) 'org-table) |
| 8210 | (save-match-data (org-at-table-p)))) | 8495 | ;; (save-match-data (org-at-table-p)))) ; FIXME: OK to not use this? |
| 8496 | (org-at-table-p))) | ||
| 8497 | |||
| 8211 | 8498 | ||
| 8212 | (defun org-self-insert-command (N) | 8499 | (defun org-self-insert-command (N) |
| 8213 | "Like `self-insert-command', use overwrite-mode for whitespace in tables. | 8500 | "Like `self-insert-command', use overwrite-mode for whitespace in tables. |
| @@ -8279,7 +8566,7 @@ a reduced column width." | |||
| 8279 | 8566 | ||
| 8280 | (defun org-shiftcursor-error () | 8567 | (defun org-shiftcursor-error () |
| 8281 | "Throw an error because Shift-Cursor command was applied in wrong context." | 8568 | "Throw an error because Shift-Cursor command was applied in wrong context." |
| 8282 | (error "This command is only active in tables and on headlines.")) | 8569 | (error "This command is only active in tables and on headlines")) |
| 8283 | 8570 | ||
| 8284 | (defun org-shifttab () | 8571 | (defun org-shifttab () |
| 8285 | "Call `(org-cycle t)' or `org-table-previous-field'." | 8572 | "Call `(org-cycle t)' or `org-table-previous-field'." |
| @@ -8410,7 +8697,7 @@ the automatic table editor has been turned off." | |||
| 8410 | (if (y-or-n-p "Convert inactive region to table? ") | 8697 | (if (y-or-n-p "Convert inactive region to table? ") |
| 8411 | (org-table-convert-region (region-beginning) (region-end) arg) | 8698 | (org-table-convert-region (region-beginning) (region-end) arg) |
| 8412 | (error "Abort"))) | 8699 | (error "Abort"))) |
| 8413 | (t (error "No table at point, and no region to make one."))))) | 8700 | (t (error "No table at point, and no region to make one"))))) |
| 8414 | 8701 | ||
| 8415 | (defun org-return () | 8702 | (defun org-return () |
| 8416 | "Call `org-table-next-row' or `newline'." | 8703 | "Call `org-table-next-row' or `newline'." |
| @@ -8469,7 +8756,9 @@ the automatic table editor has been turned off." | |||
| 8469 | ["Promote Heading" org-metaleft (not (org-at-table-p))] | 8756 | ["Promote Heading" org-metaleft (not (org-at-table-p))] |
| 8470 | ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))] | 8757 | ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))] |
| 8471 | ["Demote Heading" org-metaright (not (org-at-table-p))] | 8758 | ["Demote Heading" org-metaright (not (org-at-table-p))] |
| 8472 | ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]) | 8759 | ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))] |
| 8760 | "--" | ||
| 8761 | ["Archive Subtree" org-archive-subtree t]) | ||
| 8473 | "--" | 8762 | "--" |
| 8474 | ("TODO Lists" | 8763 | ("TODO Lists" |
| 8475 | ["TODO/DONE/-" org-todo t] | 8764 | ["TODO/DONE/-" org-todo t] |
| @@ -8533,7 +8822,7 @@ the automatic table editor has been turned off." | |||
| 8533 | ["Fill Rectangle" org-table-wrap-region (org-at-table-p)]) | 8822 | ["Fill Rectangle" org-table-wrap-region (org-at-table-p)]) |
| 8534 | "--" | 8823 | "--" |
| 8535 | ["Which Column?" org-table-current-column (org-at-table-p)] | 8824 | ["Which Column?" org-table-current-column (org-at-table-p)] |
| 8536 | ["Sum Column/Rectangle" org-table-sum | 8825 | ["Sum Column/Rectangle" org-table-sum |
| 8537 | (or (org-at-table-p) (org-region-active-p))] | 8826 | (or (org-at-table-p) (org-region-active-p))] |
| 8538 | ["Eval Formula" org-table-eval-formula (org-at-table-p)] | 8827 | ["Eval Formula" org-table-eval-formula (org-at-table-p)] |
| 8539 | "--" | 8828 | "--" |
| @@ -8576,10 +8865,10 @@ With optional NODE, go directly to that node." | |||
| 8576 | (Info-goto-node (format "(org)%s" (or node "")))) | 8865 | (Info-goto-node (format "(org)%s" (or node "")))) |
| 8577 | 8866 | ||
| 8578 | (defun org-install-agenda-files-menu () | 8867 | (defun org-install-agenda-files-menu () |
| 8579 | (easy-menu-change | 8868 | (easy-menu-change |
| 8580 | '("Org") "File List for Agenda" | 8869 | '("Org") "File List for Agenda" |
| 8581 | (append | 8870 | (append |
| 8582 | (list | 8871 | (list |
| 8583 | ["Edit File List" (customize-variable 'org-agenda-files) t] | 8872 | ["Edit File List" (customize-variable 'org-agenda-files) t] |
| 8584 | ["Add Current File to List" org-add-file t] | 8873 | ["Add Current File to List" org-add-file t] |
| 8585 | ["Remove Current File from List" org-remove-file t] | 8874 | ["Remove Current File from List" org-remove-file t] |
| @@ -8694,7 +8983,7 @@ that can be added." | |||
| 8694 | ;; Functions needed for compatibility with old outline.el | 8983 | ;; Functions needed for compatibility with old outline.el |
| 8695 | 8984 | ||
| 8696 | ;; The following functions capture almost the entire compatibility code | 8985 | ;; The following functions capture almost the entire compatibility code |
| 8697 | ;; between the different versions of outline-mode. The only other place | 8986 | ;; between the different versions of outline-mode. The only other place |
| 8698 | ;; where this is important are the font-lock-keywords. Search for | 8987 | ;; where this is important are the font-lock-keywords. Search for |
| 8699 | ;; `org-noutline-p' to find it. | 8988 | ;; `org-noutline-p' to find it. |
| 8700 | 8989 | ||
| @@ -8734,11 +9023,11 @@ Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." | |||
| 8734 | (outline-back-to-heading invisible-ok) | 9023 | (outline-back-to-heading invisible-ok) |
| 8735 | (if (looking-at outline-regexp) | 9024 | (if (looking-at outline-regexp) |
| 8736 | t | 9025 | t |
| 8737 | (if (re-search-backward (concat (if invisible-ok "[\r\n]" "^") | 9026 | (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^") |
| 8738 | outline-regexp) | 9027 | outline-regexp) |
| 8739 | nil t) | 9028 | nil t) |
| 8740 | (if invisible-ok | 9029 | (if invisible-ok |
| 8741 | (progn (forward-char 1) | 9030 | (progn (goto-char (match-end 1)) |
| 8742 | (looking-at outline-regexp))) | 9031 | (looking-at outline-regexp))) |
| 8743 | (error "Before first heading"))))) | 9032 | (error "Before first heading"))))) |
| 8744 | 9033 | ||
| @@ -8759,7 +9048,7 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too." | |||
| 8759 | This function considers both visible and invisible heading lines. | 9048 | This function considers both visible and invisible heading lines. |
| 8760 | With argument, move up ARG levels." | 9049 | With argument, move up ARG levels." |
| 8761 | (if org-noutline-p | 9050 | (if org-noutline-p |
| 8762 | (if (fboundp 'outline-up-heading-all) | 9051 | (if (fboundp 'outline-up-heading-all) |
| 8763 | (outline-up-heading-all arg) ; emacs 21 version of outline.el | 9052 | (outline-up-heading-all arg) ; emacs 21 version of outline.el |
| 8764 | (outline-up-heading arg t)) ; emacs 22 version of outline.el | 9053 | (outline-up-heading arg t)) ; emacs 22 version of outline.el |
| 8765 | (org-back-to-heading t) | 9054 | (org-back-to-heading t) |
| @@ -8815,8 +9104,8 @@ When ENTRY is non-nil, show the entire entry." | |||
| 8815 | 9104 | ||
| 8816 | (defun org-show-subtree () | 9105 | (defun org-show-subtree () |
| 8817 | "Show everything after this heading at deeper levels." | 9106 | "Show everything after this heading at deeper levels." |
| 8818 | (outline-flag-region | 9107 | (outline-flag-region |
| 8819 | (point) | 9108 | (point) |
| 8820 | (save-excursion | 9109 | (save-excursion |
| 8821 | (outline-end-of-subtree) (outline-next-heading) (point)) | 9110 | (outline-end-of-subtree) (outline-next-heading) (point)) |
| 8822 | (if org-noutline-p nil ?\n))) | 9111 | (if org-noutline-p nil ?\n))) |
| @@ -8827,7 +9116,7 @@ Show the heading too, if it is currently invisible." | |||
| 8827 | (interactive) | 9116 | (interactive) |
| 8828 | (save-excursion | 9117 | (save-excursion |
| 8829 | (org-back-to-heading t) | 9118 | (org-back-to-heading t) |
| 8830 | (outline-flag-region | 9119 | (outline-flag-region |
| 8831 | (1- (point)) | 9120 | (1- (point)) |
| 8832 | (save-excursion | 9121 | (save-excursion |
| 8833 | (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) | 9122 | (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) |
| @@ -8860,6 +9149,4 @@ Show the heading too, if it is currently invisible." | |||
| 8860 | (run-hooks 'org-load-hook) | 9149 | (run-hooks 'org-load-hook) |
| 8861 | 9150 | ||
| 8862 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 9151 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
| 8863 | |||
| 8864 | ;;; org.el ends here | 9152 | ;;; org.el ends here |
| 8865 | |||
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index b5edba97f4b..e2c58882d2a 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el | |||
| @@ -149,7 +149,7 @@ When called with a raw C-u prefix, rescan the document first." | |||
| 149 | (frame-parameter (selected-frame) 'unsplittable))) | 149 | (frame-parameter (selected-frame) 'unsplittable))) |
| 150 | offset toc-window) | 150 | offset toc-window) |
| 151 | 151 | ||
| 152 | (if (setq toc-window (get-buffer-window | 152 | (if (setq toc-window (get-buffer-window |
| 153 | "*toc*" | 153 | "*toc*" |
| 154 | (if reuse 'visible))) | 154 | (if reuse 'visible))) |
| 155 | (select-window toc-window) | 155 | (select-window toc-window) |
| @@ -165,7 +165,7 @@ When called with a raw C-u prefix, rescan the document first." | |||
| 165 | (split-window-horizontally | 165 | (split-window-horizontally |
| 166 | (floor (* (window-width) | 166 | (floor (* (window-width) |
| 167 | reftex-toc-split-windows-fraction))) | 167 | reftex-toc-split-windows-fraction))) |
| 168 | (split-window-vertically | 168 | (split-window-vertically |
| 169 | (floor (* (window-height) | 169 | (floor (* (window-height) |
| 170 | reftex-toc-split-windows-fraction))))) | 170 | reftex-toc-split-windows-fraction))))) |
| 171 | 171 | ||
| @@ -210,11 +210,11 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 210 | reftex-toc-include-context | 210 | reftex-toc-include-context |
| 211 | nil ; counter | 211 | nil ; counter |
| 212 | nil ; commented | 212 | nil ; commented |
| 213 | here-I-am | 213 | here-I-am |
| 214 | "" ; xr-prefix | 214 | "" ; xr-prefix |
| 215 | t ; a toc buffer | 215 | t ; a toc buffer |
| 216 | )) | 216 | )) |
| 217 | 217 | ||
| 218 | (run-hooks 'reftex-display-copied-context-hook) | 218 | (run-hooks 'reftex-display-copied-context-hook) |
| 219 | (message "Building *toc* buffer...done.") | 219 | (message "Building *toc* buffer...done.") |
| 220 | (setq buffer-read-only t)) | 220 | (setq buffer-read-only t)) |
| @@ -226,7 +226,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 226 | t | 226 | t |
| 227 | reftex-toc-include-index-entries | 227 | reftex-toc-include-index-entries |
| 228 | reftex-toc-include-file-boundaries) | 228 | reftex-toc-include-file-boundaries) |
| 229 | (reftex-last-assoc-before-elt | 229 | (reftex-last-assoc-before-elt |
| 230 | 'toc here-I-am | 230 | 'toc here-I-am |
| 231 | (symbol-value reftex-docstruct-symbol)))) | 231 | (symbol-value reftex-docstruct-symbol)))) |
| 232 | (put 'reftex-toc :reftex-line 3) | 232 | (put 'reftex-toc :reftex-line 3) |
| @@ -251,7 +251,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 251 | (not (get-text-property (point) 'intangible)) | 251 | (not (get-text-property (point) 'intangible)) |
| 252 | (memq reftex-highlight-selection '(cursor both)) | 252 | (memq reftex-highlight-selection '(cursor both)) |
| 253 | (reftex-highlight 2 | 253 | (reftex-highlight 2 |
| 254 | (or (previous-single-property-change | 254 | (or (previous-single-property-change |
| 255 | (min (point-max) (1+ (point))) :data) | 255 | (min (point-max) (1+ (point))) :data) |
| 256 | (point-min)) | 256 | (point-min)) |
| 257 | (or (next-single-property-change (point) :data) | 257 | (or (next-single-property-change (point) :data) |
| @@ -298,16 +298,16 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 298 | (window-height)))))) | 298 | (window-height)))))) |
| 299 | 299 | ||
| 300 | (defun reftex-toc-dframe-p (&optional frame error) | 300 | (defun reftex-toc-dframe-p (&optional frame error) |
| 301 | ;; Check if FRAME is the dedicated TOC frame. | 301 | ;; Check if FRAME is the dedicated TOC frame. |
| 302 | ;; If yes, and ERROR is non-nil, throw an error. | 302 | ;; If yes, and ERROR is non-nil, throw an error. |
| 303 | (setq frame (or frame (selected-frame))) | 303 | (setq frame (or frame (selected-frame))) |
| 304 | (let ((res (equal | 304 | (let ((res (equal |
| 305 | (if (fboundp 'frame-property) | 305 | (if (fboundp 'frame-property) |
| 306 | (frame-property frame 'name) | 306 | (frame-property frame 'name) |
| 307 | (frame-parameter frame 'name)) | 307 | (frame-parameter frame 'name)) |
| 308 | "RefTeX TOC Frame"))) | 308 | "RefTeX TOC Frame"))) |
| 309 | (if (and res error) | 309 | (if (and res error) |
| 310 | (error "This frame is view-only. Use `C-c =' to create toc window for commands.")) | 310 | (error "This frame is view-only. Use `C-c =' to create toc window for commands")) |
| 311 | res)) | 311 | res)) |
| 312 | 312 | ||
| 313 | (defun reftex-toc-show-help () | 313 | (defun reftex-toc-show-help () |
| @@ -327,7 +327,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 327 | (if (boundp 'zmacs-region-stays) (setq zmacs-region-stays t)) | 327 | (if (boundp 'zmacs-region-stays) (setq zmacs-region-stays t)) |
| 328 | (setq reftex-callback-fwd t) | 328 | (setq reftex-callback-fwd t) |
| 329 | (or (eobp) (forward-char 1)) | 329 | (or (eobp) (forward-char 1)) |
| 330 | (goto-char (or (next-single-property-change (point) :data) | 330 | (goto-char (or (next-single-property-change (point) :data) |
| 331 | (point)))) | 331 | (point)))) |
| 332 | (defun reftex-toc-previous (&optional arg) | 332 | (defun reftex-toc-previous (&optional arg) |
| 333 | "Move to previous selectable item." | 333 | "Move to previous selectable item." |
| @@ -364,7 +364,7 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help | |||
| 364 | With prefix ARG, prompt for a label type and include only labels of | 364 | With prefix ARG, prompt for a label type and include only labels of |
| 365 | that specific type." | 365 | that specific type." |
| 366 | (interactive "P") | 366 | (interactive "P") |
| 367 | (setq reftex-toc-include-labels | 367 | (setq reftex-toc-include-labels |
| 368 | (if arg (reftex-query-label-type) | 368 | (if arg (reftex-query-label-type) |
| 369 | (not reftex-toc-include-labels))) | 369 | (not reftex-toc-include-labels))) |
| 370 | (reftex-toc-revert)) | 370 | (reftex-toc-revert)) |
| @@ -468,7 +468,7 @@ With prefix arg 1, restrict index to the section at point." | |||
| 468 | (defun reftex-toc-rescan (&rest ignore) | 468 | (defun reftex-toc-rescan (&rest ignore) |
| 469 | "Regenerate the *toc* buffer by reparsing file of section at point." | 469 | "Regenerate the *toc* buffer by reparsing file of section at point." |
| 470 | (interactive) | 470 | (interactive) |
| 471 | (if (and reftex-enable-partial-scans | 471 | (if (and reftex-enable-partial-scans |
| 472 | (null current-prefix-arg)) | 472 | (null current-prefix-arg)) |
| 473 | (let* ((data (get-text-property (point) :data)) | 473 | (let* ((data (get-text-property (point) :data)) |
| 474 | (what (car data)) | 474 | (what (car data)) |
| @@ -502,7 +502,7 @@ With prefix arg 1, restrict index to the section at point." | |||
| 502 | (defun reftex-toc-revert (&rest ignore) | 502 | (defun reftex-toc-revert (&rest ignore) |
| 503 | "Regenerate the *toc* from the internal lists." | 503 | "Regenerate the *toc* from the internal lists." |
| 504 | (interactive) | 504 | (interactive) |
| 505 | (let ((unsplittable | 505 | (let ((unsplittable |
| 506 | (if (fboundp 'frame-property) | 506 | (if (fboundp 'frame-property) |
| 507 | (frame-property (selected-frame) 'unsplittable) | 507 | (frame-property (selected-frame) 'unsplittable) |
| 508 | (frame-parameter (selected-frame) 'unsplittable))) | 508 | (frame-parameter (selected-frame) 'unsplittable))) |
| @@ -589,7 +589,7 @@ point." | |||
| 589 | (goto-char start-pos) | 589 | (goto-char start-pos) |
| 590 | (setq sections (reftex-toc-extract-section-number (car entries))) | 590 | (setq sections (reftex-toc-extract-section-number (car entries))) |
| 591 | (if (> (setq nsec (length entries)) 1) | 591 | (if (> (setq nsec (length entries)) 1) |
| 592 | (setq sections | 592 | (setq sections |
| 593 | (concat sections "-" | 593 | (concat sections "-" |
| 594 | (reftex-toc-extract-section-number | 594 | (reftex-toc-extract-section-number |
| 595 | (nth (1- nsec) entries))))) | 595 | (nth (1- nsec) entries))))) |
| @@ -614,7 +614,7 @@ point." | |||
| 614 | (save-window-excursion | 614 | (save-window-excursion |
| 615 | (reftex-toc-Rescan)) | 615 | (reftex-toc-Rescan)) |
| 616 | (reftex-toc-restore-region start-line mark-line) | 616 | (reftex-toc-restore-region start-line mark-line) |
| 617 | (message "%d section%s %smoted" | 617 | (message "%d section%s %smoted" |
| 618 | nsec (if (= 1 nsec) "" "s") pro-or-de) | 618 | nsec (if (= 1 nsec) "" "s") pro-or-de) |
| 619 | nil)) | 619 | nil)) |
| 620 | (if msg (progn (ding) (message msg))))) | 620 | (if msg (progn (ding) (message msg))))) |
| @@ -667,7 +667,7 @@ promotion/demotion later." | |||
| 667 | (beginning-of-line 1) | 667 | (beginning-of-line 1) |
| 668 | (if (looking-at reftex-section-regexp) | 668 | (if (looking-at reftex-section-regexp) |
| 669 | (setq name (reftex-match-string 2)) | 669 | (setq name (reftex-match-string 2)) |
| 670 | (error "Something is wrong! Contact maintainer!"))) | 670 | (error "Something is wrong! Contact maintainer!"))) |
| 671 | ;; Section has changed, request scan and loading | 671 | ;; Section has changed, request scan and loading |
| 672 | ;; We use a variable to delay until after the safe-exc. | 672 | ;; We use a variable to delay until after the safe-exc. |
| 673 | ;; because otherwise we loose the region. | 673 | ;; because otherwise we loose the region. |
| @@ -776,7 +776,7 @@ label prefix determines the wording of a reference." | |||
| 776 | (error "This is not a label entry.")) | 776 | (error "This is not a label entry.")) |
| 777 | (setq newlabel (read-string (format "Rename label \"%s\" to:" label))) | 777 | (setq newlabel (read-string (format "Rename label \"%s\" to:" label))) |
| 778 | (if (assoc newlabel (symbol-value reftex-docstruct-symbol)) | 778 | (if (assoc newlabel (symbol-value reftex-docstruct-symbol)) |
| 779 | (if (not (y-or-n-p | 779 | (if (not (y-or-n-p |
| 780 | (format "Label '%s' exists. Use anyway? " label))) | 780 | (format "Label '%s' exists. Use anyway? " label))) |
| 781 | (error "Abort"))) | 781 | (error "Abort"))) |
| 782 | (save-excursion | 782 | (save-excursion |
| @@ -786,7 +786,7 @@ label prefix determines the wording of a reference." | |||
| 786 | (reftex-query-replace-document | 786 | (reftex-query-replace-document |
| 787 | (concat "{" (regexp-quote label) "}") | 787 | (concat "{" (regexp-quote label) "}") |
| 788 | (format "{%s}" newlabel)) | 788 | (format "{%s}" newlabel)) |
| 789 | (error t)))) | 789 | (error t)))) |
| 790 | (reftex-toc-rescan))) | 790 | (reftex-toc-rescan))) |
| 791 | 791 | ||
| 792 | 792 | ||
| @@ -805,9 +805,9 @@ label prefix determines the wording of a reference." | |||
| 805 | show-window show-buffer match) | 805 | show-window show-buffer match) |
| 806 | 806 | ||
| 807 | (unless toc (error "Don't know which toc line to visit")) | 807 | (unless toc (error "Don't know which toc line to visit")) |
| 808 | 808 | ||
| 809 | (cond | 809 | (cond |
| 810 | 810 | ||
| 811 | ((eq (car toc) 'toc) | 811 | ((eq (car toc) 'toc) |
| 812 | ;; a toc entry | 812 | ;; a toc entry |
| 813 | (setq match (reftex-toc-find-section toc no-revisit))) | 813 | (setq match (reftex-toc-find-section toc no-revisit))) |
| @@ -823,7 +823,7 @@ label prefix determines the wording of a reference." | |||
| 823 | (file (nth 1 toc))) | 823 | (file (nth 1 toc))) |
| 824 | (if (or (not no-revisit) (reftex-get-buffer-visiting file)) | 824 | (if (or (not no-revisit) (reftex-get-buffer-visiting file)) |
| 825 | (progn | 825 | (progn |
| 826 | (switch-to-buffer-other-window | 826 | (switch-to-buffer-other-window |
| 827 | (reftex-get-file-buffer-force file nil)) | 827 | (reftex-get-file-buffer-force file nil)) |
| 828 | (goto-char (if (eq where 'bof) (point-min) (point-max)))) | 828 | (goto-char (if (eq where 'bof) (point-min) (point-max)))) |
| 829 | (message reftex-no-follow-message) nil)))) | 829 | (message reftex-no-follow-message) nil)))) |
| @@ -876,8 +876,8 @@ label prefix determines the wording of a reference." | |||
| 876 | (looking-at (reftex-make-desperate-section-regexp literal)) | 876 | (looking-at (reftex-make-desperate-section-regexp literal)) |
| 877 | (looking-at (concat "\\\\" | 877 | (looking-at (concat "\\\\" |
| 878 | (regexp-quote | 878 | (regexp-quote |
| 879 | (car | 879 | (car |
| 880 | (rassq level | 880 | (rassq level |
| 881 | reftex-section-levels-all))) | 881 | reftex-section-levels-all))) |
| 882 | "[[{]?")))) | 882 | "[[{]?")))) |
| 883 | ((or (not no-revisit) | 883 | ((or (not no-revisit) |
| @@ -1047,7 +1047,7 @@ always show the current section in connection with the option | |||
| 1047 | (define-key reftex-toc-map (vector (list key)) 'digit-argument)) | 1047 | (define-key reftex-toc-map (vector (list key)) 'digit-argument)) |
| 1048 | (define-key reftex-toc-map "-" 'negative-argument) | 1048 | (define-key reftex-toc-map "-" 'negative-argument) |
| 1049 | 1049 | ||
| 1050 | (easy-menu-define | 1050 | (easy-menu-define |
| 1051 | reftex-toc-menu reftex-toc-map | 1051 | reftex-toc-menu reftex-toc-map |
| 1052 | "Menu for Table of Contents buffer" | 1052 | "Menu for Table of Contents buffer" |
| 1053 | '("TOC" | 1053 | '("TOC" |
| @@ -1080,7 +1080,7 @@ always show the current section in connection with the option | |||
| 1080 | ["Context" reftex-toc-toggle-context :style toggle | 1080 | ["Context" reftex-toc-toggle-context :style toggle |
| 1081 | :selected reftex-toc-include-context] | 1081 | :selected reftex-toc-include-context] |
| 1082 | "--" | 1082 | "--" |
| 1083 | ["Follow Mode" reftex-toc-toggle-follow :style toggle | 1083 | ["Follow Mode" reftex-toc-toggle-follow :style toggle |
| 1084 | :selected reftex-toc-follow-mode] | 1084 | :selected reftex-toc-follow-mode] |
| 1085 | ["Auto Recenter" reftex-toggle-auto-toc-recenter :style toggle | 1085 | ["Auto Recenter" reftex-toggle-auto-toc-recenter :style toggle |
| 1086 | :selected reftex-toc-auto-recenter-timer] | 1086 | :selected reftex-toc-auto-recenter-timer] |
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index f8b4cba65ae..574c17a07f9 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | ;;--------------------------------------------------------------------------- | 26 | ;;--------------------------------------------------------------------------- |
| 27 | ;; | 27 | ;; |
| 28 | ;;; Commentary: | 28 | ;;; Commentary: |
| 29 | ;; | 29 | ;; |
| 30 | ;; RefTeX is a minor mode with distinct support for \ref, \label, \cite, | 30 | ;; RefTeX is a minor mode with distinct support for \ref, \label, \cite, |
| 31 | ;; and \index commands in (multi-file) LaTeX documents. | 31 | ;; and \index commands in (multi-file) LaTeX documents. |
| 32 | ;; - A table of contents provides easy access to any part of a document. | 32 | ;; - A table of contents provides easy access to any part of a document. |
| @@ -71,7 +71,7 @@ | |||
| 71 | ;; | 71 | ;; |
| 72 | ;; Introduction | 72 | ;; Introduction |
| 73 | ;; ************ | 73 | ;; ************ |
| 74 | ;; | 74 | ;; |
| 75 | ;; RefTeX is a specialized package for support of labels, references, | 75 | ;; RefTeX is a specialized package for support of labels, references, |
| 76 | ;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX | 76 | ;; citations, and the index in LaTeX. RefTeX wraps itself round 4 LaTeX |
| 77 | ;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros | 77 | ;; macros: `\label', `\ref', `\cite', and `\index'. Using these macros |
| @@ -80,13 +80,13 @@ | |||
| 80 | ;; time-consuming tasks almost entirely. It also provides functions to | 80 | ;; time-consuming tasks almost entirely. It also provides functions to |
| 81 | ;; display the structure of a document and to move around in this | 81 | ;; display the structure of a document and to move around in this |
| 82 | ;; structure quickly. | 82 | ;; structure quickly. |
| 83 | ;; | 83 | ;; |
| 84 | ;; *Note Imprint::, for information about who to contact for help, bug | 84 | ;; *Note Imprint::, for information about who to contact for help, bug |
| 85 | ;; reports or suggestions. | 85 | ;; reports or suggestions. |
| 86 | ;; | 86 | ;; |
| 87 | ;; Environment | 87 | ;; Environment |
| 88 | ;; =========== | 88 | ;; =========== |
| 89 | ;; | 89 | ;; |
| 90 | ;; RefTeX needs to access all files which are part of a multifile | 90 | ;; RefTeX needs to access all files which are part of a multifile |
| 91 | ;; document, and the BibTeX database files requested by the | 91 | ;; document, and the BibTeX database files requested by the |
| 92 | ;; `\bibliography' command. To find these files, RefTeX will require a | 92 | ;; `\bibliography' command. To find these files, RefTeX will require a |
| @@ -95,26 +95,26 @@ | |||
| 95 | ;; which are also used by RefTeX. However, on some systems these | 95 | ;; which are also used by RefTeX. However, on some systems these |
| 96 | ;; variables do not contain the full search path. If RefTeX does not work | 96 | ;; variables do not contain the full search path. If RefTeX does not work |
| 97 | ;; for you because it cannot find some files, read *Note Finding Files::. | 97 | ;; for you because it cannot find some files, read *Note Finding Files::. |
| 98 | ;; | 98 | ;; |
| 99 | ;; Entering RefTeX Mode | 99 | ;; Entering RefTeX Mode |
| 100 | ;; ==================== | 100 | ;; ==================== |
| 101 | ;; | 101 | ;; |
| 102 | ;; To turn RefTeX Mode on and off in a particular buffer, use `M-x | 102 | ;; To turn RefTeX Mode on and off in a particular buffer, use `M-x |
| 103 | ;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the | 103 | ;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the |
| 104 | ;; following lines to your `.emacs' file: | 104 | ;; following lines to your `.emacs' file: |
| 105 | ;; | 105 | ;; |
| 106 | ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode | 106 | ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode |
| 107 | ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode | 107 | ;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode |
| 108 | ;; | 108 | ;; |
| 109 | ;; RefTeX in a Nutshell | 109 | ;; RefTeX in a Nutshell |
| 110 | ;; ==================== | 110 | ;; ==================== |
| 111 | ;; | 111 | ;; |
| 112 | ;; 1. Table of Contents | 112 | ;; 1. Table of Contents |
| 113 | ;; Typing `C-c =' (`reftex-toc') will show a table of contents of the | 113 | ;; Typing `C-c =' (`reftex-toc') will show a table of contents of the |
| 114 | ;; document. This buffer can display sections, labels and index | 114 | ;; document. This buffer can display sections, labels and index |
| 115 | ;; entries defined in the document. From the buffer, you can jump | 115 | ;; entries defined in the document. From the buffer, you can jump |
| 116 | ;; quickly to every part of your document. Press `?' to get help. | 116 | ;; quickly to every part of your document. Press `?' to get help. |
| 117 | ;; | 117 | ;; |
| 118 | ;; 2. Labels and References | 118 | ;; 2. Labels and References |
| 119 | ;; RefTeX helps to create unique labels and to find the correct key | 119 | ;; RefTeX helps to create unique labels and to find the correct key |
| 120 | ;; for references quickly. It distinguishes labels for different | 120 | ;; for references quickly. It distinguishes labels for different |
| @@ -122,7 +122,7 @@ | |||
| 122 | ;; others), and can be configured to recognize any additional labeled | 122 | ;; others), and can be configured to recognize any additional labeled |
| 123 | ;; environments you have defined yourself (variable | 123 | ;; environments you have defined yourself (variable |
| 124 | ;; `reftex-label-alist'). | 124 | ;; `reftex-label-alist'). |
| 125 | ;; | 125 | ;; |
| 126 | ;; * Creating Labels | 126 | ;; * Creating Labels |
| 127 | ;; Type `C-c (' (`reftex-label') to insert a label at point. | 127 | ;; Type `C-c (' (`reftex-label') to insert a label at point. |
| 128 | ;; RefTeX will either | 128 | ;; RefTeX will either |
| @@ -131,17 +131,17 @@ | |||
| 131 | ;; tables) or | 131 | ;; tables) or |
| 132 | ;; - insert a simple label made of a prefix and a number (all | 132 | ;; - insert a simple label made of a prefix and a number (all |
| 133 | ;; other environments) | 133 | ;; other environments) |
| 134 | ;; | 134 | ;; |
| 135 | ;; Which labels are created how is configurable with the variable | 135 | ;; Which labels are created how is configurable with the variable |
| 136 | ;; `reftex-insert-label-flags'. | 136 | ;; `reftex-insert-label-flags'. |
| 137 | ;; | 137 | ;; |
| 138 | ;; * Referencing Labels | 138 | ;; * Referencing Labels |
| 139 | ;; To make a reference, type `C-c )' (`reftex-reference'). This | 139 | ;; To make a reference, type `C-c )' (`reftex-reference'). This |
| 140 | ;; shows an outline of the document with all labels of a certain | 140 | ;; shows an outline of the document with all labels of a certain |
| 141 | ;; type (figure, equation,...) and some label context. | 141 | ;; type (figure, equation,...) and some label context. |
| 142 | ;; Selecting a label inserts a `\ref{LABEL}' macro into the | 142 | ;; Selecting a label inserts a `\ref{LABEL}' macro into the |
| 143 | ;; original buffer. | 143 | ;; original buffer. |
| 144 | ;; | 144 | ;; |
| 145 | ;; 3. Citations | 145 | ;; 3. Citations |
| 146 | ;; Typing `C-c [' (`reftex-citation') will let you specify a regular | 146 | ;; Typing `C-c [' (`reftex-citation') will let you specify a regular |
| 147 | ;; expression to search in current BibTeX database files (as | 147 | ;; expression to search in current BibTeX database files (as |
| @@ -150,7 +150,7 @@ | |||
| 150 | ;; sorted. The selected article is referenced as `\cite{KEY}' (see | 150 | ;; sorted. The selected article is referenced as `\cite{KEY}' (see |
| 151 | ;; the variable `reftex-cite-format' if you want to insert different | 151 | ;; the variable `reftex-cite-format' if you want to insert different |
| 152 | ;; macros). | 152 | ;; macros). |
| 153 | ;; | 153 | ;; |
| 154 | ;; 4. Index Support | 154 | ;; 4. Index Support |
| 155 | ;; RefTeX helps to enter index entries. It also compiles all entries | 155 | ;; RefTeX helps to enter index entries. It also compiles all entries |
| 156 | ;; into an alphabetically sorted `*Index*' buffer which you can use | 156 | ;; into an alphabetically sorted `*Index*' buffer which you can use |
| @@ -158,25 +158,25 @@ | |||
| 158 | ;; index macros and can be configured to recognize any additional | 158 | ;; index macros and can be configured to recognize any additional |
| 159 | ;; macros you have defined (`reftex-index-macros'). Multiple indices | 159 | ;; macros you have defined (`reftex-index-macros'). Multiple indices |
| 160 | ;; are supported. | 160 | ;; are supported. |
| 161 | ;; | 161 | ;; |
| 162 | ;; * Creating Index Entries | 162 | ;; * Creating Index Entries |
| 163 | ;; To index the current selection or the word at point, type | 163 | ;; To index the current selection or the word at point, type |
| 164 | ;; `C-c /' (`reftex-index-selection-or-word'). The default macro | 164 | ;; `C-c /' (`reftex-index-selection-or-word'). The default macro |
| 165 | ;; `reftex-index-default-macro' will be used. For a more | 165 | ;; `reftex-index-default-macro' will be used. For a more |
| 166 | ;; complex entry type `C-c <' (`reftex-index'), select any of | 166 | ;; complex entry type `C-c <' (`reftex-index'), select any of |
| 167 | ;; the index macros and enter the arguments with completion. | 167 | ;; the index macros and enter the arguments with completion. |
| 168 | ;; | 168 | ;; |
| 169 | ;; * The Index Phrases File (Delayed Indexing) | 169 | ;; * The Index Phrases File (Delayed Indexing) |
| 170 | ;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add | 170 | ;; Type `C-c \' (`reftex-index-phrase-selection-or-word') to add |
| 171 | ;; the current word or selection to a special _index phrase | 171 | ;; the current word or selection to a special _index phrase |
| 172 | ;; file_. RefTeX can later search the document for occurrences | 172 | ;; file_. RefTeX can later search the document for occurrences |
| 173 | ;; of these phrases and let you interactively index the matches. | 173 | ;; of these phrases and let you interactively index the matches. |
| 174 | ;; | 174 | ;; |
| 175 | ;; * Displaying and Editing the Index | 175 | ;; * Displaying and Editing the Index |
| 176 | ;; To display the compiled index in a special buffer, type `C-c | 176 | ;; To display the compiled index in a special buffer, type `C-c |
| 177 | ;; >' (`reftex-display-index'). From that buffer you can check | 177 | ;; >' (`reftex-display-index'). From that buffer you can check |
| 178 | ;; and edit all entries. | 178 | ;; and edit all entries. |
| 179 | ;; | 179 | ;; |
| 180 | ;; 5. Viewing Cross-References | 180 | ;; 5. Viewing Cross-References |
| 181 | ;; When point is on the KEY argument of a cross-referencing macro | 181 | ;; When point is on the KEY argument of a cross-referencing macro |
| 182 | ;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations) | 182 | ;; (`\label', `\ref', `\cite', `\bibitem', `\index', and variations) |
| @@ -186,14 +186,14 @@ | |||
| 186 | ;; When the enclosing macro is `\cite' or `\ref' and no other message | 186 | ;; When the enclosing macro is `\cite' or `\ref' and no other message |
| 187 | ;; occupies the echo area, information about the citation or label | 187 | ;; occupies the echo area, information about the citation or label |
| 188 | ;; will automatically be displayed in the echo area. | 188 | ;; will automatically be displayed in the echo area. |
| 189 | ;; | 189 | ;; |
| 190 | ;; 6. Multifile Documents | 190 | ;; 6. Multifile Documents |
| 191 | ;; Multifile Documents are fully supported. The included files must | 191 | ;; Multifile Documents are fully supported. The included files must |
| 192 | ;; have a file variable `TeX-master' or `tex-main-file' pointing to | 192 | ;; have a file variable `TeX-master' or `tex-main-file' pointing to |
| 193 | ;; the master file. RefTeX provides cross-referencing information | 193 | ;; the master file. RefTeX provides cross-referencing information |
| 194 | ;; from all parts of the document, and across document borders | 194 | ;; from all parts of the document, and across document borders |
| 195 | ;; (`xr.sty'). | 195 | ;; (`xr.sty'). |
| 196 | ;; | 196 | ;; |
| 197 | ;; 7. Document Parsing | 197 | ;; 7. Document Parsing |
| 198 | ;; RefTeX needs to parse the document in order to find labels and | 198 | ;; RefTeX needs to parse the document in order to find labels and |
| 199 | ;; other information. It does it automatically once and updates its | 199 | ;; other information. It does it automatically once and updates its |
| @@ -202,23 +202,23 @@ | |||
| 202 | ;; with a raw `C-u' prefix, or press the `r' key in the label | 202 | ;; with a raw `C-u' prefix, or press the `r' key in the label |
| 203 | ;; selection buffer, the table of contents buffer, or the index | 203 | ;; selection buffer, the table of contents buffer, or the index |
| 204 | ;; buffer. | 204 | ;; buffer. |
| 205 | ;; | 205 | ;; |
| 206 | ;; 8. AUCTeX | 206 | ;; 8. AUCTeX |
| 207 | ;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it | 207 | ;; If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it |
| 208 | ;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style | 208 | ;; (see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style |
| 209 | ;; files which trigger appropriate settings in RefTeX, so that for | 209 | ;; files which trigger appropriate settings in RefTeX, so that for |
| 210 | ;; many of the popular LaTeX packages no additional customizations | 210 | ;; many of the popular LaTeX packages no additional customizations |
| 211 | ;; will be necessary. | 211 | ;; will be necessary. |
| 212 | ;; | 212 | ;; |
| 213 | ;; 9. Useful Settings | 213 | ;; 9. Useful Settings |
| 214 | ;; To make RefTeX faster for large documents, try these: | 214 | ;; To make RefTeX faster for large documents, try these: |
| 215 | ;; (setq reftex-enable-partial-scans t) | 215 | ;; (setq reftex-enable-partial-scans t) |
| 216 | ;; (setq reftex-save-parse-info t) | 216 | ;; (setq reftex-save-parse-info t) |
| 217 | ;; (setq reftex-use-multiple-selection-buffers t) | 217 | ;; (setq reftex-use-multiple-selection-buffers t) |
| 218 | ;; | 218 | ;; |
| 219 | ;; To integrate with AUCTeX, use | 219 | ;; To integrate with AUCTeX, use |
| 220 | ;; (setq reftex-plug-into-AUCTeX t) | 220 | ;; (setq reftex-plug-into-AUCTeX t) |
| 221 | ;; | 221 | ;; |
| 222 | ;; To make your own LaTeX macro definitions known to RefTeX, | 222 | ;; To make your own LaTeX macro definitions known to RefTeX, |
| 223 | ;; customize the variables | 223 | ;; customize the variables |
| 224 | ;; `reftex-label-alist' (for label macros/environments) | 224 | ;; `reftex-label-alist' (for label macros/environments) |
| @@ -228,7 +228,7 @@ | |||
| 228 | ;; `reftex-index-default-macro' (to set the default macro) | 228 | ;; `reftex-index-default-macro' (to set the default macro) |
| 229 | ;; If you have a large number of macros defined, you may want to write | 229 | ;; If you have a large number of macros defined, you may want to write |
| 230 | ;; an AUCTeX style file to support them with both AUCTeX and RefTeX. | 230 | ;; an AUCTeX style file to support them with both AUCTeX and RefTeX. |
| 231 | ;; | 231 | ;; |
| 232 | ;; 10. Where Next? | 232 | ;; 10. Where Next? |
| 233 | ;; Go ahead and use RefTeX. Use its menus until you have picked up | 233 | ;; Go ahead and use RefTeX. Use its menus until you have picked up |
| 234 | ;; the key bindings. For an overview of what you can do in each of | 234 | ;; the key bindings. For an overview of what you can do in each of |
| @@ -237,7 +237,7 @@ | |||
| 237 | ;; The first part of the manual explains in a tutorial way how to use | 237 | ;; The first part of the manual explains in a tutorial way how to use |
| 238 | ;; and customize RefTeX. The second part is a command and variable | 238 | ;; and customize RefTeX. The second part is a command and variable |
| 239 | ;; reference. | 239 | ;; reference. |
| 240 | ;; | 240 | ;; |
| 241 | ;;--------------------------------------------------------------------------- | 241 | ;;--------------------------------------------------------------------------- |
| 242 | ;; | 242 | ;; |
| 243 | ;; AUTHOR | 243 | ;; AUTHOR |
| @@ -319,7 +319,7 @@ | |||
| 319 | (setq reftex-syntax-table (copy-syntax-table)) | 319 | (setq reftex-syntax-table (copy-syntax-table)) |
| 320 | (modify-syntax-entry ?\( "." reftex-syntax-table) | 320 | (modify-syntax-entry ?\( "." reftex-syntax-table) |
| 321 | (modify-syntax-entry ?\) "." reftex-syntax-table)) | 321 | (modify-syntax-entry ?\) "." reftex-syntax-table)) |
| 322 | 322 | ||
| 323 | (unless reftex-syntax-table-for-bib | 323 | (unless reftex-syntax-table-for-bib |
| 324 | (setq reftex-syntax-table-for-bib | 324 | (setq reftex-syntax-table-for-bib |
| 325 | (copy-syntax-table reftex-syntax-table)) | 325 | (copy-syntax-table reftex-syntax-table)) |
| @@ -395,7 +395,7 @@ on the menu bar. | |||
| 395 | (setq reftex-syntax-table (copy-syntax-table (syntax-table))) | 395 | (setq reftex-syntax-table (copy-syntax-table (syntax-table))) |
| 396 | (modify-syntax-entry ?\( "." reftex-syntax-table) | 396 | (modify-syntax-entry ?\( "." reftex-syntax-table) |
| 397 | (modify-syntax-entry ?\) "." reftex-syntax-table) | 397 | (modify-syntax-entry ?\) "." reftex-syntax-table) |
| 398 | 398 | ||
| 399 | (setq reftex-syntax-table-for-bib | 399 | (setq reftex-syntax-table-for-bib |
| 400 | (copy-syntax-table reftex-syntax-table)) | 400 | (copy-syntax-table reftex-syntax-table)) |
| 401 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) | 401 | (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib) |
| @@ -536,7 +536,7 @@ on the menu bar. | |||
| 536 | ((master | 536 | ((master |
| 537 | (cond | 537 | (cond |
| 538 | ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. | 538 | ((fboundp 'TeX-master-file) ; AUCTeX is loaded. Use its mechanism. |
| 539 | (condition-case nil | 539 | (condition-case nil |
| 540 | (TeX-master-file t) | 540 | (TeX-master-file t) |
| 541 | (error (buffer-file-name)))) | 541 | (error (buffer-file-name)))) |
| 542 | ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode | 542 | ((fboundp 'tex-main-file) (tex-main-file)) ; Emacs LaTeX mode |
| @@ -737,14 +737,14 @@ the label information is recompiled on next use." | |||
| 737 | 737 | ||
| 738 | ;; A list of all variables in the cache. | 738 | ;; A list of all variables in the cache. |
| 739 | ;; The cache is used to save the compiled versions of some variables. | 739 | ;; The cache is used to save the compiled versions of some variables. |
| 740 | (defconst reftex-cache-variables | 740 | (defconst reftex-cache-variables |
| 741 | '(reftex-memory ;; This MUST ALWAYS be the first! | 741 | '(reftex-memory ;; This MUST ALWAYS be the first! |
| 742 | 742 | ||
| 743 | ;; Outline | 743 | ;; Outline |
| 744 | reftex-section-levels-all | 744 | reftex-section-levels-all |
| 745 | 745 | ||
| 746 | ;; Labels | 746 | ;; Labels |
| 747 | reftex-env-or-mac-alist | 747 | reftex-env-or-mac-alist |
| 748 | reftex-special-env-parsers | 748 | reftex-special-env-parsers |
| 749 | reftex-macros-with-labels | 749 | reftex-macros-with-labels |
| 750 | reftex-label-mac-list | 750 | reftex-label-mac-list |
| @@ -761,7 +761,7 @@ the label information is recompiled on next use." | |||
| 761 | reftex-index-macro-alist | 761 | reftex-index-macro-alist |
| 762 | reftex-macros-with-index | 762 | reftex-macros-with-index |
| 763 | reftex-query-index-macro-prompt | 763 | reftex-query-index-macro-prompt |
| 764 | reftex-query-index-macro-help | 764 | reftex-query-index-macro-help |
| 765 | reftex-key-to-index-macro-alist | 765 | reftex-key-to-index-macro-alist |
| 766 | 766 | ||
| 767 | ;; Regular expressions | 767 | ;; Regular expressions |
| @@ -806,7 +806,7 @@ the label information is recompiled on next use." | |||
| 806 | (t (reftex-compile-variables))))) | 806 | (t (reftex-compile-variables))))) |
| 807 | 807 | ||
| 808 | (defun reftex-reset-mode () | 808 | (defun reftex-reset-mode () |
| 809 | "Reset RefTeX Mode. | 809 | "Reset RefTeX Mode. |
| 810 | This will re-compile the configuration information and remove all | 810 | This will re-compile the configuration information and remove all |
| 811 | current scanning information and the parse file to enforce a rescan | 811 | current scanning information and the parse file to enforce a rescan |
| 812 | on next use." | 812 | on next use." |
| @@ -857,12 +857,12 @@ This enforces rescanning the buffer on next use." | |||
| 857 | 857 | ||
| 858 | (defun reftex-erase-all-selection-and-index-buffers () | 858 | (defun reftex-erase-all-selection-and-index-buffers () |
| 859 | ;; Remove all selection buffers associated with current document. | 859 | ;; Remove all selection buffers associated with current document. |
| 860 | (mapcar | 860 | (mapcar |
| 861 | (lambda (type) | 861 | (lambda (type) |
| 862 | (reftex-erase-buffer (reftex-make-selection-buffer-name type))) | 862 | (reftex-erase-buffer (reftex-make-selection-buffer-name type))) |
| 863 | reftex-typekey-list) | 863 | reftex-typekey-list) |
| 864 | ;; Kill all index buffers | 864 | ;; Kill all index buffers |
| 865 | (mapcar | 865 | (mapcar |
| 866 | (lambda (tag) | 866 | (lambda (tag) |
| 867 | (reftex-kill-buffer (reftex-make-index-buffer-name tag))) | 867 | (reftex-kill-buffer (reftex-make-index-buffer-name tag))) |
| 868 | (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) | 868 | (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) |
| @@ -878,7 +878,7 @@ This enforces rescanning the buffer on next use." | |||
| 878 | 878 | ||
| 879 | ;; Record that we have done this, and what we have used. | 879 | ;; Record that we have done this, and what we have used. |
| 880 | (setq reftex-tables-dirty nil) | 880 | (setq reftex-tables-dirty nil) |
| 881 | (setq reftex-memory | 881 | (setq reftex-memory |
| 882 | (list reftex-label-alist | 882 | (list reftex-label-alist |
| 883 | (get reftex-docstruct-symbol 'reftex-section-levels) | 883 | (get reftex-docstruct-symbol 'reftex-section-levels) |
| 884 | (get reftex-docstruct-symbol 'reftex-label-alist-style) | 884 | (get reftex-docstruct-symbol 'reftex-label-alist-style) |
| @@ -897,7 +897,7 @@ This enforces rescanning the buffer on next use." | |||
| 897 | '(nil))) | 897 | '(nil))) |
| 898 | (all-index (reftex-uniquify-by-car | 898 | (all-index (reftex-uniquify-by-car |
| 899 | (reftex-splice-symbols-into-list | 899 | (reftex-splice-symbols-into-list |
| 900 | (append reftex-index-macros | 900 | (append reftex-index-macros |
| 901 | (get reftex-docstruct-symbol | 901 | (get reftex-docstruct-symbol |
| 902 | 'reftex-index-macros-style) | 902 | 'reftex-index-macros-style) |
| 903 | '(default)) | 903 | '(default)) |
| @@ -908,7 +908,7 @@ This enforces rescanning the buffer on next use." | |||
| 908 | macro verify repeat nindex tag key toc-level toc-levels) | 908 | macro verify repeat nindex tag key toc-level toc-levels) |
| 909 | 909 | ||
| 910 | (setq reftex-words-to-typekey-alist nil | 910 | (setq reftex-words-to-typekey-alist nil |
| 911 | reftex-prefix-to-typekey-alist | 911 | reftex-prefix-to-typekey-alist |
| 912 | '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s")) | 912 | '(("sec:" . "s") ("cha:" . "s") ("chap:" . "s")) |
| 913 | reftex-typekey-list nil | 913 | reftex-typekey-list nil |
| 914 | reftex-typekey-to-format-alist nil | 914 | reftex-typekey-to-format-alist nil |
| @@ -964,7 +964,7 @@ This enforces rescanning the buffer on next use." | |||
| 964 | ((symbolp env-or-mac) | 964 | ((symbolp env-or-mac) |
| 965 | ;; A special parser function | 965 | ;; A special parser function |
| 966 | (unless (fboundp env-or-mac) | 966 | (unless (fboundp env-or-mac) |
| 967 | (message "Warning: %s does not seem to be a valid function" | 967 | (message "Warning: %s does not seem to be a valid function" |
| 968 | env-or-mac)) | 968 | env-or-mac)) |
| 969 | (setq nargs nil nlabel nil opt-args nil) | 969 | (setq nargs nil nlabel nil opt-args nil) |
| 970 | (add-to-list 'reftex-special-env-parsers env-or-mac) | 970 | (add-to-list 'reftex-special-env-parsers env-or-mac) |
| @@ -992,8 +992,8 @@ This enforces rescanning the buffer on next use." | |||
| 992 | (push (cons string toc-level) toc-levels)))))))) | 992 | (push (cons string toc-level) toc-levels)))))))) |
| 993 | ;; Translate some special context cases | 993 | ;; Translate some special context cases |
| 994 | (when (assq context reftex-default-context-regexps) | 994 | (when (assq context reftex-default-context-regexps) |
| 995 | (setq context | 995 | (setq context |
| 996 | (format | 996 | (format |
| 997 | (cdr (assq context reftex-default-context-regexps)) | 997 | (cdr (assq context reftex-default-context-regexps)) |
| 998 | (regexp-quote env-or-mac)))) | 998 | (regexp-quote env-or-mac)))) |
| 999 | ;; See if this is the first format for this typekey | 999 | ;; See if this is the first format for this typekey |
| @@ -1026,7 +1026,7 @@ This enforces rescanning the buffer on next use." | |||
| 1026 | (nreverse reftex-typekey-to-prefix-alist)) | 1026 | (nreverse reftex-typekey-to-prefix-alist)) |
| 1027 | 1027 | ||
| 1028 | ;; Prepare the typekey query prompt and help string. | 1028 | ;; Prepare the typekey query prompt and help string. |
| 1029 | (setq qh-list | 1029 | (setq qh-list |
| 1030 | (sort qh-list | 1030 | (sort qh-list |
| 1031 | (lambda (x1 x2) | 1031 | (lambda (x1 x2) |
| 1032 | (string< (downcase (car x1)) (downcase (car x2)))))) | 1032 | (string< (downcase (car x1)) (downcase (car x2)))))) |
| @@ -1037,7 +1037,7 @@ This enforces rescanning the buffer on next use." | |||
| 1037 | "]")) | 1037 | "]")) |
| 1038 | ;; In the help string, we need to wrap lines... | 1038 | ;; In the help string, we need to wrap lines... |
| 1039 | (setq reftex-type-query-help | 1039 | (setq reftex-type-query-help |
| 1040 | (concat | 1040 | (concat |
| 1041 | "SELECT A LABEL TYPE:\n--------------------\n" | 1041 | "SELECT A LABEL TYPE:\n--------------------\n" |
| 1042 | (mapconcat | 1042 | (mapconcat |
| 1043 | (lambda(x) | 1043 | (lambda(x) |
| @@ -1057,7 +1057,7 @@ This enforces rescanning the buffer on next use." | |||
| 1057 | ;; which allow for some chars from the ref format to be in the buffer. | 1057 | ;; which allow for some chars from the ref format to be in the buffer. |
| 1058 | ;; These characters will be seen and removed. | 1058 | ;; These characters will be seen and removed. |
| 1059 | (setq reftex-words-to-typekey-alist | 1059 | (setq reftex-words-to-typekey-alist |
| 1060 | (mapcar | 1060 | (mapcar |
| 1061 | (lambda (x) | 1061 | (lambda (x) |
| 1062 | (setq word (car x) | 1062 | (setq word (car x) |
| 1063 | typekey (cdr x) | 1063 | typekey (cdr x) |
| @@ -1110,18 +1110,18 @@ This enforces rescanning the buffer on next use." | |||
| 1110 | (setq reftex-key-to-index-macro-alist | 1110 | (setq reftex-key-to-index-macro-alist |
| 1111 | (sort reftex-key-to-index-macro-alist | 1111 | (sort reftex-key-to-index-macro-alist |
| 1112 | (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) | 1112 | (lambda (a b) (< (downcase (car a)) (downcase (car b)))))) |
| 1113 | (setq reftex-query-index-macro-prompt | 1113 | (setq reftex-query-index-macro-prompt |
| 1114 | (concat "Index macro: [" | 1114 | (concat "Index macro: [" |
| 1115 | (mapconcat (lambda (x) (char-to-string (car x))) | 1115 | (mapconcat (lambda (x) (char-to-string (car x))) |
| 1116 | reftex-key-to-index-macro-alist "") | 1116 | reftex-key-to-index-macro-alist "") |
| 1117 | "]")) | 1117 | "]")) |
| 1118 | (setq i 0 | 1118 | (setq i 0 |
| 1119 | reftex-query-index-macro-help | 1119 | reftex-query-index-macro-help |
| 1120 | (concat | 1120 | (concat |
| 1121 | "SELECT A MACRO:\n---------------\n" | 1121 | "SELECT A MACRO:\n---------------\n" |
| 1122 | (mapconcat | 1122 | (mapconcat |
| 1123 | (lambda(x) | 1123 | (lambda(x) |
| 1124 | (format "[%c] %-20.20s%s" (car x) (nth 1 x) | 1124 | (format "[%c] %-20.20s%s" (car x) (nth 1 x) |
| 1125 | (if (= 0 (mod (incf i) 3)) "\n" ""))) | 1125 | (if (= 0 (mod (incf i) 3)) "\n" ""))) |
| 1126 | reftex-key-to-index-macro-alist ""))) | 1126 | reftex-key-to-index-macro-alist ""))) |
| 1127 | 1127 | ||
| @@ -1135,11 +1135,11 @@ This enforces rescanning the buffer on next use." | |||
| 1135 | (let* ( | 1135 | (let* ( |
| 1136 | ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") | 1136 | ; (wbol "\\(\\`\\|[\n\r]\\)[ \t]*") |
| 1137 | (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because | 1137 | (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because |
| 1138 | ;;; because match number are hard coded | 1138 | ;;; because match number are hard coded |
| 1139 | (label-re "\\\\label{\\([^}]*\\)}") | 1139 | (label-re "\\\\label{\\([^}]*\\)}") |
| 1140 | (include-re (concat wbol | 1140 | (include-re (concat wbol |
| 1141 | "\\\\\\(" | 1141 | "\\\\\\(" |
| 1142 | (mapconcat 'identity | 1142 | (mapconcat 'identity |
| 1143 | reftex-include-file-commands "\\|") | 1143 | reftex-include-file-commands "\\|") |
| 1144 | "\\)[{ \t]+\\([^} \t\n\r]+\\)")) | 1144 | "\\)[{ \t]+\\([^} \t\n\r]+\\)")) |
| 1145 | (section-re | 1145 | (section-re |
| @@ -1193,7 +1193,7 @@ This enforces rescanning the buffer on next use." | |||
| 1193 | reftex-macros-with-labels macros-with-labels | 1193 | reftex-macros-with-labels macros-with-labels |
| 1194 | reftex-find-index-entry-regexp-format find-index-re-format | 1194 | reftex-find-index-entry-regexp-format find-index-re-format |
| 1195 | reftex-find-label-regexp-format find-label-re-format | 1195 | reftex-find-label-regexp-format find-label-re-format |
| 1196 | reftex-find-label-regexp-format2 | 1196 | reftex-find-label-regexp-format2 |
| 1197 | "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") | 1197 | "\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]") |
| 1198 | (message "Compiling label environment definitions...done"))) | 1198 | (message "Compiling label environment definitions...done"))) |
| 1199 | (put reftex-docstruct-symbol 'reftex-cache | 1199 | (put reftex-docstruct-symbol 'reftex-cache |
| @@ -1232,7 +1232,7 @@ This enforces rescanning the buffer on next use." | |||
| 1232 | ;; Error out in a buffer without a file. | 1232 | ;; Error out in a buffer without a file. |
| 1233 | (if (and reftex-mode | 1233 | (if (and reftex-mode |
| 1234 | (not (buffer-file-name))) | 1234 | (not (buffer-file-name))) |
| 1235 | (error "RefTeX works only in buffers visiting a file.")) | 1235 | (error "RefTeX works only in buffers visiting a file")) |
| 1236 | 1236 | ||
| 1237 | ;; Make sure we have the symbols tied | 1237 | ;; Make sure we have the symbols tied |
| 1238 | (if (eq reftex-docstruct-symbol nil) | 1238 | (if (eq reftex-docstruct-symbol nil) |
| @@ -1270,7 +1270,7 @@ This enforces rescanning the buffer on next use." | |||
| 1270 | (and (symbolp reftex-docstruct-symbol) | 1270 | (and (symbolp reftex-docstruct-symbol) |
| 1271 | (symbol-value reftex-docstruct-symbol) | 1271 | (symbol-value reftex-docstruct-symbol) |
| 1272 | t)) | 1272 | t)) |
| 1273 | 1273 | ||
| 1274 | (defun reftex-silence-toc-markers (list n) | 1274 | (defun reftex-silence-toc-markers (list n) |
| 1275 | ;; Set all toc markers in the first N entries in list to nil | 1275 | ;; Set all toc markers in the first N entries in list to nil |
| 1276 | (while (and list (> (decf n) -1)) | 1276 | (while (and list (> (decf n) -1)) |
| @@ -1287,7 +1287,7 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1287 | (master (reftex-TeX-master-file)) | 1287 | (master (reftex-TeX-master-file)) |
| 1288 | (enable-local-variables nil) | 1288 | (enable-local-variables nil) |
| 1289 | (file (if (string-match "\\.[a-zA-Z]+\\'" master) | 1289 | (file (if (string-match "\\.[a-zA-Z]+\\'" master) |
| 1290 | (concat (substring master 0 (match-beginning 0)) | 1290 | (concat (substring master 0 (match-beginning 0)) |
| 1291 | reftex-parse-file-extension) | 1291 | reftex-parse-file-extension) |
| 1292 | (concat master reftex-parse-file-extension)))) | 1292 | (concat master reftex-parse-file-extension)))) |
| 1293 | (cond | 1293 | (cond |
| @@ -1366,7 +1366,7 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1366 | 1366 | ||
| 1367 | ;; Check if the master is the same: when moving a document, this will see it. | 1367 | ;; Check if the master is the same: when moving a document, this will see it. |
| 1368 | (let* ((real-master (reftex-TeX-master-file)) | 1368 | (let* ((real-master (reftex-TeX-master-file)) |
| 1369 | (parsed-master | 1369 | (parsed-master |
| 1370 | (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) | 1370 | (nth 1 (assq 'bof (symbol-value reftex-docstruct-symbol))))) |
| 1371 | (unless (string= (file-truename real-master) (file-truename parsed-master)) | 1371 | (unless (string= (file-truename real-master) (file-truename parsed-master)) |
| 1372 | (message "Master file name in load file is different: %s versus %s" | 1372 | (message "Master file name in load file is different: %s versus %s" |
| @@ -1386,7 +1386,7 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1386 | (defun reftex-select-external-document (xr-alist xr-index) | 1386 | (defun reftex-select-external-document (xr-alist xr-index) |
| 1387 | ;; Return index of an external document. | 1387 | ;; Return index of an external document. |
| 1388 | (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) | 1388 | (let* ((len (length xr-alist)) (highest (1- (+ ?0 len))) |
| 1389 | (prompt (format "[%c-%c] Select TAB: Read prefix with completion" | 1389 | (prompt (format "[%c-%c] Select TAB: Read prefix with completion" |
| 1390 | ?0 highest)) | 1390 | ?0 highest)) |
| 1391 | key prefix) | 1391 | key prefix) |
| 1392 | (cond | 1392 | (cond |
| @@ -1397,7 +1397,7 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1397 | (- 1 xr-index)) | 1397 | (- 1 xr-index)) |
| 1398 | (t | 1398 | (t |
| 1399 | (save-excursion | 1399 | (save-excursion |
| 1400 | (let* ((length (apply 'max (mapcar | 1400 | (let* ((length (apply 'max (mapcar |
| 1401 | (lambda(x) (length (car x))) xr-alist))) | 1401 | (lambda(x) (length (car x))) xr-alist))) |
| 1402 | (fmt (format " [%%c] %%-%ds %%s\n" length)) | 1402 | (fmt (format " [%%c] %%-%ds %%s\n" length)) |
| 1403 | (n (1- ?0))) | 1403 | (n (1- ?0))) |
| @@ -1407,7 +1407,7 @@ Valid actions are: readable, restore, read, kill, write." | |||
| 1407 | (concat | 1407 | (concat |
| 1408 | "SELECT EXTERNAL DOCUMENT\n------------------------\n" | 1408 | "SELECT EXTERNAL DOCUMENT\n------------------------\n" |
| 1409 | (mapconcat | 1409 | (mapconcat |
| 1410 | (lambda (x) | 1410 | (lambda (x) |
| 1411 | (format fmt (incf n) (or (car x) "") | 1411 | (format fmt (incf n) (or (car x) "") |
| 1412 | (abbreviate-file-name (cdr x)))) | 1412 | (abbreviate-file-name (cdr x)))) |
| 1413 | xr-alist "")) | 1413 | xr-alist "")) |
| @@ -1431,7 +1431,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1431 | (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) | 1431 | (let* ((rec-values (if reftex-search-unrecursed-path-first '(nil t) '(t))) |
| 1432 | (extensions (cdr (assoc type reftex-file-extensions))) | 1432 | (extensions (cdr (assoc type reftex-file-extensions))) |
| 1433 | (def-ext (car extensions)) | 1433 | (def-ext (car extensions)) |
| 1434 | (ext-re (concat "\\(" | 1434 | (ext-re (concat "\\(" |
| 1435 | (mapconcat 'regexp-quote extensions "\\|") | 1435 | (mapconcat 'regexp-quote extensions "\\|") |
| 1436 | "\\)\\'")) | 1436 | "\\)\\'")) |
| 1437 | (files (if (string-match ext-re file) | 1437 | (files (if (string-match ext-re file) |
| @@ -1440,8 +1440,8 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1440 | path old-path file1) | 1440 | path old-path file1) |
| 1441 | (cond | 1441 | (cond |
| 1442 | ((file-name-absolute-p file) | 1442 | ((file-name-absolute-p file) |
| 1443 | (setq file1 | 1443 | (setq file1 |
| 1444 | (or | 1444 | (or |
| 1445 | (and (car files) (file-regular-p (car files)) (car files)) | 1445 | (and (car files) (file-regular-p (car files)) (car files)) |
| 1446 | (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) | 1446 | (and (cdr files) (file-regular-p (cdr files)) (cdr files))))) |
| 1447 | ((and reftex-use-external-file-finders | 1447 | ((and reftex-use-external-file-finders |
| @@ -1456,10 +1456,10 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1456 | (setq old-path path | 1456 | (setq old-path path |
| 1457 | path (cons master-dir path) | 1457 | path (cons master-dir path) |
| 1458 | file1 (or (and (car files) | 1458 | file1 (or (and (car files) |
| 1459 | (reftex-find-file-on-path | 1459 | (reftex-find-file-on-path |
| 1460 | (car files) path master-dir)) | 1460 | (car files) path master-dir)) |
| 1461 | (and (cdr files) | 1461 | (and (cdr files) |
| 1462 | (reftex-find-file-on-path | 1462 | (reftex-find-file-on-path |
| 1463 | (cdr files) path master-dir)))))))) | 1463 | (cdr files) path master-dir)))))))) |
| 1464 | (cond (file1 file1) | 1464 | (cond (file1 file1) |
| 1465 | (die (error "No such file: %s" file) nil) | 1465 | (die (error "No such file: %s" file) nil) |
| @@ -1504,7 +1504,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1504 | (reftex-uniquify | 1504 | (reftex-uniquify |
| 1505 | (reftex-parse-colon-path | 1505 | (reftex-parse-colon-path |
| 1506 | (mapconcat | 1506 | (mapconcat |
| 1507 | (lambda(x) | 1507 | (lambda(x) |
| 1508 | (if (string-match "^!" x) | 1508 | (if (string-match "^!" x) |
| 1509 | (apply 'reftex-process-string | 1509 | (apply 'reftex-process-string |
| 1510 | (split-string (substring x 1))) | 1510 | (split-string (substring x 1))) |
| @@ -1513,7 +1513,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1513 | ;; (cdr (assoc type reftex-path-environment)) | 1513 | ;; (cdr (assoc type reftex-path-environment)) |
| 1514 | ;; However, historically we have separate options for the | 1514 | ;; However, historically we have separate options for the |
| 1515 | ;; environment variables, so we have to do this: | 1515 | ;; environment variables, so we have to do this: |
| 1516 | (symbol-value (intern (concat "reftex-" type | 1516 | (symbol-value (intern (concat "reftex-" type |
| 1517 | "path-environment-variables"))) | 1517 | "path-environment-variables"))) |
| 1518 | path-separator)))) | 1518 | path-separator)))) |
| 1519 | (put pathvar 'status 'split) | 1519 | (put pathvar 'status 'split) |
| @@ -1539,11 +1539,11 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1539 | ;; or: Relative recursive path elements need to be expanded | 1539 | ;; or: Relative recursive path elements need to be expanded |
| 1540 | ;; relative to new default directory | 1540 | ;; relative to new default directory |
| 1541 | (message "Expanding search path to find %s file: %s ..." type file) | 1541 | (message "Expanding search path to find %s file: %s ..." type file) |
| 1542 | (put pathvar 'recursive-path | 1542 | (put pathvar 'recursive-path |
| 1543 | (reftex-expand-path (symbol-value pathvar) master-dir)) | 1543 | (reftex-expand-path (symbol-value pathvar) master-dir)) |
| 1544 | (put pathvar 'master-dir master-dir) | 1544 | (put pathvar 'master-dir master-dir) |
| 1545 | (get pathvar 'recursive-path)) | 1545 | (get pathvar 'recursive-path)) |
| 1546 | (t | 1546 | (t |
| 1547 | ;; Recursive path computed earlier is still OK. | 1547 | ;; Recursive path computed earlier is still OK. |
| 1548 | (get pathvar 'recursive-path))) | 1548 | (get pathvar 'recursive-path))) |
| 1549 | ;; The simple path was requested | 1549 | ;; The simple path was requested |
| @@ -1572,7 +1572,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1572 | ;; Trailing ! or !! will be converted into `//' (emTeX convention) | 1572 | ;; Trailing ! or !! will be converted into `//' (emTeX convention) |
| 1573 | (mapcar | 1573 | (mapcar |
| 1574 | (lambda (dir) | 1574 | (lambda (dir) |
| 1575 | (if (string-match "\\(//+\\|/*!+\\)\\'" dir) | 1575 | (if (string-match "\\(//+\\|/*!+\\)\\'" dir) |
| 1576 | (setq dir (replace-match "//" t t dir))) | 1576 | (setq dir (replace-match "//" t t dir))) |
| 1577 | (file-name-as-directory dir)) | 1577 | (file-name-as-directory dir)) |
| 1578 | (delete "" (split-string path (concat path-separator "+"))))) | 1578 | (delete "" (split-string path (concat path-separator "+"))))) |
| @@ -1601,7 +1601,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1601 | (when (file-directory-p dir) | 1601 | (when (file-directory-p dir) |
| 1602 | (setq files (nreverse (directory-files dir t "[^.]"))) | 1602 | (setq files (nreverse (directory-files dir t "[^.]"))) |
| 1603 | (while (setq file (pop files)) | 1603 | (while (setq file (pop files)) |
| 1604 | (if (file-directory-p file) | 1604 | (if (file-directory-p file) |
| 1605 | (push (file-name-as-directory file) path))) | 1605 | (push (file-name-as-directory file) path))) |
| 1606 | (push dir path1))) | 1606 | (push dir path1))) |
| 1607 | path1)) | 1607 | path1)) |
| @@ -1664,7 +1664,7 @@ When DIE is non-nil, throw an error if file not found." | |||
| 1664 | "Show the table of contents for the current document." t) | 1664 | "Show the table of contents for the current document." t) |
| 1665 | (autoload 'reftex-toc-recenter "reftex-toc" | 1665 | (autoload 'reftex-toc-recenter "reftex-toc" |
| 1666 | "Display the TOC window and highlight line corresponding to current position." t) | 1666 | "Display the TOC window and highlight line corresponding to current position." t) |
| 1667 | (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" | 1667 | (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" |
| 1668 | "Toggle automatic recentering of TOC window." t) | 1668 | "Toggle automatic recentering of TOC window." t) |
| 1669 | 1669 | ||
| 1670 | ;;; ========================================================================= | 1670 | ;;; ========================================================================= |
| @@ -1883,7 +1883,7 @@ Works on both Emacs and XEmacs." | |||
| 1883 | (while list | 1883 | (while list |
| 1884 | (if (funcall predicate (car list)) | 1884 | (if (funcall predicate (car list)) |
| 1885 | (push (if completion | 1885 | (push (if completion |
| 1886 | (list (nth nth (car list))) | 1886 | (list (nth nth (car list))) |
| 1887 | (nth nth (car list))) | 1887 | (nth nth (car list))) |
| 1888 | rtn)) | 1888 | rtn)) |
| 1889 | (setq list (cdr list))) | 1889 | (setq list (cdr list))) |
| @@ -1919,7 +1919,7 @@ Works on both Emacs and XEmacs." | |||
| 1919 | ;; If POS is given, calculate distances relative to it. | 1919 | ;; If POS is given, calculate distances relative to it. |
| 1920 | ;; Return nil if there is no match. | 1920 | ;; Return nil if there is no match. |
| 1921 | (let ((pos (point)) | 1921 | (let ((pos (point)) |
| 1922 | (dist (or max-length (length regexp))) | 1922 | (dist (or max-length (length regexp))) |
| 1923 | match1 match2 match) | 1923 | match1 match2 match) |
| 1924 | (goto-char (min (+ pos dist) (point-max))) | 1924 | (goto-char (min (+ pos dist) (point-max))) |
| 1925 | (when (re-search-backward regexp nil t) | 1925 | (when (re-search-backward regexp nil t) |
| @@ -2005,10 +2005,10 @@ Works on both Emacs and XEmacs." | |||
| 2005 | ((and scroll (equal char ?\C-? )) | 2005 | ((and scroll (equal char ?\C-? )) |
| 2006 | (condition-case nil (scroll-down) (error nil)) | 2006 | (condition-case nil (scroll-down) (error nil)) |
| 2007 | (message prompt)) | 2007 | (message prompt)) |
| 2008 | (t (message "") | 2008 | (t (message "") |
| 2009 | (throw 'exit char))) | 2009 | (throw 'exit char))) |
| 2010 | (setq char (read-char-exclusive))))))) | 2010 | (setq char (read-char-exclusive))))))) |
| 2011 | 2011 | ||
| 2012 | 2012 | ||
| 2013 | (defun reftex-make-regexp-allow-for-ctrl-m (string) | 2013 | (defun reftex-make-regexp-allow-for-ctrl-m (string) |
| 2014 | ;; convert STRING into a regexp, allowing ^M for \n and vice versa | 2014 | ;; convert STRING into a regexp, allowing ^M for \n and vice versa |
| @@ -2206,10 +2206,10 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2206 | ;; Restrict number of words | 2206 | ;; Restrict number of words |
| 2207 | (if (> (length words) nwords) | 2207 | (if (> (length words) nwords) |
| 2208 | (setcdr (nthcdr (1- nwords) words) nil)) | 2208 | (setcdr (nthcdr (1- nwords) words) nil)) |
| 2209 | 2209 | ||
| 2210 | ;; First, try to use all words | 2210 | ;; First, try to use all words |
| 2211 | (setq string (mapconcat 'identity words sep)) | 2211 | (setq string (mapconcat 'identity words sep)) |
| 2212 | 2212 | ||
| 2213 | ;; Abbreviate words if enforced by user settings or string length | 2213 | ;; Abbreviate words if enforced by user settings or string length |
| 2214 | (if (or (eq t abbrev) | 2214 | (if (or (eq t abbrev) |
| 2215 | (and abbrev | 2215 | (and abbrev |
| @@ -2301,7 +2301,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2301 | (font-lock-set-defaults-1) | 2301 | (font-lock-set-defaults-1) |
| 2302 | (reftex-select-font-lock-fontify-region (point-min) (point-max)))) | 2302 | (reftex-select-font-lock-fontify-region (point-min) (point-max)))) |
| 2303 | (t | 2303 | (t |
| 2304 | ;; Oops? | 2304 | ;; Oops? |
| 2305 | (message "Sorry: cannot refontify RefTeX Select buffer.")))) | 2305 | (message "Sorry: cannot refontify RefTeX Select buffer.")))) |
| 2306 | (rename-buffer oldname)))) | 2306 | (rename-buffer oldname)))) |
| 2307 | 2307 | ||
| @@ -2350,7 +2350,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2350 | 2350 | ||
| 2351 | ;; Initialize the overlays | 2351 | ;; Initialize the overlays |
| 2352 | (aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1)) | 2352 | (aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1)) |
| 2353 | (reftex-overlay-put (aref reftex-highlight-overlays 0) | 2353 | (reftex-overlay-put (aref reftex-highlight-overlays 0) |
| 2354 | 'face 'highlight) | 2354 | 'face 'highlight) |
| 2355 | (aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1)) | 2355 | (aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1)) |
| 2356 | (reftex-overlay-put (aref reftex-highlight-overlays 1) | 2356 | (reftex-overlay-put (aref reftex-highlight-overlays 1) |
| @@ -2375,7 +2375,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2375 | 2375 | ||
| 2376 | ;;; ========================================================================= | 2376 | ;;; ========================================================================= |
| 2377 | ;;; | 2377 | ;;; |
| 2378 | ;;; Keybindings | 2378 | ;;; Keybindings |
| 2379 | 2379 | ||
| 2380 | ;; The default bindings in the mode map. | 2380 | ;; The default bindings in the mode map. |
| 2381 | (loop for x in | 2381 | (loop for x in |
| @@ -2395,10 +2395,10 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2395 | ;; Bind `reftex-mouse-view-crossref' only when the key is still free | 2395 | ;; Bind `reftex-mouse-view-crossref' only when the key is still free |
| 2396 | (if (featurep 'xemacs) | 2396 | (if (featurep 'xemacs) |
| 2397 | (unless (key-binding [(shift button2)]) | 2397 | (unless (key-binding [(shift button2)]) |
| 2398 | (define-key reftex-mode-map [(shift button2)] | 2398 | (define-key reftex-mode-map [(shift button2)] |
| 2399 | 'reftex-mouse-view-crossref)) | 2399 | 'reftex-mouse-view-crossref)) |
| 2400 | (unless (key-binding [(shift mouse-2)]) | 2400 | (unless (key-binding [(shift mouse-2)]) |
| 2401 | (define-key reftex-mode-map [(shift mouse-2)] | 2401 | (define-key reftex-mode-map [(shift mouse-2)] |
| 2402 | 'reftex-mouse-view-crossref))) | 2402 | 'reftex-mouse-view-crossref))) |
| 2403 | 2403 | ||
| 2404 | ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map | 2404 | ;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map |
| @@ -2502,7 +2502,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2502 | ("Reference Style" | 2502 | ("Reference Style" |
| 2503 | ["Default" (setq reftex-vref-is-default nil | 2503 | ["Default" (setq reftex-vref-is-default nil |
| 2504 | reftex-fref-is-default nil) | 2504 | reftex-fref-is-default nil) |
| 2505 | :style radio :selected (not (or reftex-vref-is-default | 2505 | :style radio :selected (not (or reftex-vref-is-default |
| 2506 | reftex-fref-is-default))] | 2506 | reftex-fref-is-default))] |
| 2507 | ["Varioref" (setq reftex-vref-is-default t | 2507 | ["Varioref" (setq reftex-vref-is-default t |
| 2508 | reftex-fref-is-default nil) | 2508 | reftex-fref-is-default nil) |
| @@ -2537,7 +2537,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2537 | (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) | 2537 | (list 'reftex-add-index-macros (list 'list (list 'quote (car x)))) |
| 2538 | :style 'radio :selected | 2538 | :style 'radio :selected |
| 2539 | (list 'memq (list 'quote (car x)) | 2539 | (list 'memq (list 'quote (car x)) |
| 2540 | (list 'get 'reftex-docstruct-symbol | 2540 | (list 'get 'reftex-docstruct-symbol |
| 2541 | (list 'quote 'reftex-index-macros-style))))) | 2541 | (list 'quote 'reftex-index-macros-style))))) |
| 2542 | reftex-index-macros-builtin)) | 2542 | reftex-index-macros-builtin)) |
| 2543 | "--" | 2543 | "--" |
| @@ -2546,7 +2546,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2546 | ("Customize" | 2546 | ("Customize" |
| 2547 | ["Browse RefTeX Group" reftex-customize t] | 2547 | ["Browse RefTeX Group" reftex-customize t] |
| 2548 | "--" | 2548 | "--" |
| 2549 | ["Build Full Customize Menu" reftex-create-customize-menu | 2549 | ["Build Full Customize Menu" reftex-create-customize-menu |
| 2550 | (fboundp 'customize-menu-create)]) | 2550 | (fboundp 'customize-menu-create)]) |
| 2551 | ("Documentation" | 2551 | ("Documentation" |
| 2552 | ["Info" reftex-info t] | 2552 | ["Info" reftex-info t] |
| @@ -2562,7 +2562,7 @@ IGNORE-WORDS List of words which should be removed from the string." | |||
| 2562 | (interactive) | 2562 | (interactive) |
| 2563 | (if (fboundp 'customize-menu-create) | 2563 | (if (fboundp 'customize-menu-create) |
| 2564 | (progn | 2564 | (progn |
| 2565 | (easy-menu-change | 2565 | (easy-menu-change |
| 2566 | '("Ref") "Customize" | 2566 | '("Ref") "Customize" |
| 2567 | `(["Browse RefTeX group" reftex-customize t] | 2567 | `(["Browse RefTeX group" reftex-customize t] |
| 2568 | "--" | 2568 | "--" |
| @@ -2600,7 +2600,7 @@ With optional NODE, go directly to that node." | |||
| 2600 | ;;; That's it! ---------------------------------------------------------------- | 2600 | ;;; That's it! ---------------------------------------------------------------- |
| 2601 | 2601 | ||
| 2602 | (setq reftex-tables-dirty t) ; in case this file is evaluated by hand | 2602 | (setq reftex-tables-dirty t) ; in case this file is evaluated by hand |
| 2603 | (provide 'reftex) | 2603 | (provide 'reftex) |
| 2604 | 2604 | ||
| 2605 | ;;;============================================================================ | 2605 | ;;;============================================================================ |
| 2606 | 2606 | ||
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index cdc2916e799..7e1167a9396 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -248,11 +248,13 @@ separated by a space." | |||
| 248 | "Regular expression that matches a non-empty start tag. | 248 | "Regular expression that matches a non-empty start tag. |
| 249 | Any terminating `>' or `/' is not matched.") | 249 | Any terminating `>' or `/' is not matched.") |
| 250 | 250 | ||
| 251 | (defface sgml-namespace-face | 251 | (defface sgml-namespace |
| 252 | '((t (:inherit font-lock-builtin-face))) | 252 | '((t (:inherit font-lock-builtin-face))) |
| 253 | "`sgml-mode' face used to highlight the namespace part of identifiers." | 253 | "`sgml-mode' face used to highlight the namespace part of identifiers." |
| 254 | :group 'sgml) | 254 | :group 'sgml) |
| 255 | (defvar sgml-namespace-face 'sgml-namespace-face) | 255 | ;; backward-compatibility alias |
| 256 | (put 'sgml-namespace-face 'face-alias 'sgml-namespace) | ||
| 257 | (defvar sgml-namespace-face 'sgml-namespace) | ||
| 256 | 258 | ||
| 257 | ;; internal | 259 | ;; internal |
| 258 | (defconst sgml-font-lock-keywords-1 | 260 | (defconst sgml-font-lock-keywords-1 |
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index 430a196166f..af13c2fe61c 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el | |||
| @@ -682,7 +682,7 @@ height." | |||
| 682 | :tag "Table Command Prefix" | 682 | :tag "Table Command Prefix" |
| 683 | :group 'table) | 683 | :group 'table) |
| 684 | 684 | ||
| 685 | (defface table-cell-face | 685 | (defface table-cell |
| 686 | '((((min-colors 88) (class color)) | 686 | '((((min-colors 88) (class color)) |
| 687 | (:foreground "gray90" :background "blue1")) | 687 | (:foreground "gray90" :background "blue1")) |
| 688 | (((class color)) | 688 | (((class color)) |
| @@ -691,6 +691,8 @@ height." | |||
| 691 | "*Face used for table cell contents." | 691 | "*Face used for table cell contents." |
| 692 | :tag "Cell Face" | 692 | :tag "Cell Face" |
| 693 | :group 'table) | 693 | :group 'table) |
| 694 | ;; backward-compatibility alias | ||
| 695 | (put 'table-cell-face 'face-alias 'table-cell) | ||
| 694 | 696 | ||
| 695 | (defcustom table-cell-horizontal-chars "-=" | 697 | (defcustom table-cell-horizontal-chars "-=" |
| 696 | "*Characters that may be used for table cell's horizontal border line." | 698 | "*Characters that may be used for table cell's horizontal border line." |
| @@ -5264,7 +5266,7 @@ and the right cell border character." | |||
| 5264 | 5266 | ||
| 5265 | (defun table--put-cell-face-property (beg end &optional object) | 5267 | (defun table--put-cell-face-property (beg end &optional object) |
| 5266 | "Put cell face property." | 5268 | "Put cell face property." |
| 5267 | (put-text-property beg end 'face 'table-cell-face object)) | 5269 | (put-text-property beg end 'face 'table-cell object)) |
| 5268 | 5270 | ||
| 5269 | (defun table--put-cell-keymap-property (beg end &optional object) | 5271 | (defun table--put-cell-keymap-property (beg end &optional object) |
| 5270 | "Put cell keymap property." | 5272 | "Put cell keymap property." |
| @@ -5303,8 +5305,8 @@ instead of the current buffer and returns the OBJECT." | |||
| 5303 | (defun table--update-cell-face () | 5305 | (defun table--update-cell-face () |
| 5304 | "Update cell face according to the current mode." | 5306 | "Update cell face according to the current mode." |
| 5305 | (if (featurep 'xemacs) | 5307 | (if (featurep 'xemacs) |
| 5306 | (set-face-property 'table-cell-face 'underline table-fixed-width-mode) | 5308 | (set-face-property 'table-cell 'underline table-fixed-width-mode) |
| 5307 | (set-face-inverse-video-p 'table-cell-face table-fixed-width-mode))) | 5309 | (set-face-inverse-video-p 'table-cell table-fixed-width-mode))) |
| 5308 | 5310 | ||
| 5309 | (table--update-cell-face) | 5311 | (table--update-cell-face) |
| 5310 | 5312 | ||
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 66dc7b83507..7d04464346a 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -650,17 +650,22 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 650 | "Face used for subscripts." | 650 | "Face used for subscripts." |
| 651 | :group 'tex) | 651 | :group 'tex) |
| 652 | 652 | ||
| 653 | (defface tex-math-face | 653 | (defface tex-math |
| 654 | '((t :inherit font-lock-string-face)) | 654 | '((t :inherit font-lock-string-face)) |
| 655 | "Face used to highlight TeX math expressions." | 655 | "Face used to highlight TeX math expressions." |
| 656 | :group 'tex) | 656 | :group 'tex) |
| 657 | (defvar tex-math-face 'tex-math-face) | 657 | ;; backward-compatibility alias |
| 658 | (defface tex-verbatim-face | 658 | (put 'tex-math-face 'face-alias 'tex-math) |
| 659 | (defvar tex-math-face 'tex-math) | ||
| 660 | |||
| 661 | (defface tex-verbatim | ||
| 659 | ;; '((t :inherit font-lock-string-face)) | 662 | ;; '((t :inherit font-lock-string-face)) |
| 660 | '((t :family "courier")) | 663 | '((t :family "courier")) |
| 661 | "Face used to highlight TeX verbatim environments." | 664 | "Face used to highlight TeX verbatim environments." |
| 662 | :group 'tex) | 665 | :group 'tex) |
| 663 | (defvar tex-verbatim-face 'tex-verbatim-face) | 666 | ;; backward-compatibility alias |
| 667 | (put 'tex-verbatim-face 'face-alias 'tex-verbatim) | ||
| 668 | (defvar tex-verbatim-face 'tex-verbatim) | ||
| 664 | 669 | ||
| 665 | ;; Use string syntax but math face for $...$. | 670 | ;; Use string syntax but math face for $...$. |
| 666 | (defun tex-font-lock-syntactic-face-function (state) | 671 | (defun tex-font-lock-syntactic-face-function (state) |
| @@ -795,7 +800,7 @@ Inherits `shell-mode-map' with a few additions.") | |||
| 795 | (regexp-opt '("documentstyle" "documentclass" | 800 | (regexp-opt '("documentstyle" "documentclass" |
| 796 | "begin" "subsection" "section" | 801 | "begin" "subsection" "section" |
| 797 | "part" "chapter" "newcommand" | 802 | "part" "chapter" "newcommand" |
| 798 | "renewcommand") 'words) | 803 | "renewcommand" "RequirePackage") 'words) |
| 799 | "\\|NeedsTeXFormat{LaTeX"))) | 804 | "\\|NeedsTeXFormat{LaTeX"))) |
| 800 | (if (and (looking-at | 805 | (if (and (looking-at |
| 801 | "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") | 806 | "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") |
| @@ -1101,7 +1106,7 @@ Inserts the value of `tex-open-quote' (normally ``) or `tex-close-quote' | |||
| 1101 | inserts \" characters." | 1106 | inserts \" characters." |
| 1102 | (interactive "*P") | 1107 | (interactive "*P") |
| 1103 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) | 1108 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) |
| 1104 | (eq (get-text-property (point) 'face) 'tex-verbatim-face) | 1109 | (eq (get-text-property (point) 'face) tex-verbatim-face) |
| 1105 | (save-excursion | 1110 | (save-excursion |
| 1106 | (backward-char (length tex-open-quote)) | 1111 | (backward-char (length tex-open-quote)) |
| 1107 | (when (or (looking-at (regexp-quote tex-open-quote)) | 1112 | (when (or (looking-at (regexp-quote tex-open-quote)) |
| @@ -1639,9 +1644,12 @@ If NOT-ALL is non-nil, save the `.dvi' file." | |||
| 1639 | " " (if (< 0 (length tex-start-commands)) | 1644 | " " (if (< 0 (length tex-start-commands)) |
| 1640 | (shell-quote-argument tex-start-commands)) " %f") | 1645 | (shell-quote-argument tex-start-commands)) " %f") |
| 1641 | t "%r.dvi") | 1646 | t "%r.dvi") |
| 1642 | ("yap %r &" "%r.dvi") | ||
| 1643 | ("xdvi %r &" "%r.dvi") | 1647 | ("xdvi %r &" "%r.dvi") |
| 1648 | ("xpdf %r.pdf &" "%r.pdf") | ||
| 1649 | ("gv %r.ps &" "%r.ps") | ||
| 1650 | ("yap %r &" "%r.dvi") | ||
| 1644 | ("advi %r &" "%r.dvi") | 1651 | ("advi %r &" "%r.dvi") |
| 1652 | ("gv %r.pdf &" "%r.pdf") | ||
| 1645 | ("bibtex %r" "%r.aux" "%r.bbl") | 1653 | ("bibtex %r" "%r.aux" "%r.bbl") |
| 1646 | ("makeindex %r" "%r.idx" "%r.ind") | 1654 | ("makeindex %r" "%r.idx" "%r.ind") |
| 1647 | ("texindex %r.??") | 1655 | ("texindex %r.??") |
| @@ -1649,9 +1657,6 @@ If NOT-ALL is non-nil, save the `.dvi' file." | |||
| 1649 | ("dvipdf %r" "%r.dvi" "%r.pdf") | 1657 | ("dvipdf %r" "%r.dvi" "%r.pdf") |
| 1650 | ("dvips -o %r.ps %r" "%r.dvi" "%r.ps") | 1658 | ("dvips -o %r.ps %r" "%r.dvi" "%r.ps") |
| 1651 | ("ps2pdf %r.ps" "%r.ps" "%r.pdf") | 1659 | ("ps2pdf %r.ps" "%r.ps" "%r.pdf") |
| 1652 | ("gv %r.ps &" "%r.ps") | ||
| 1653 | ("gv %r.pdf &" "%r.pdf") | ||
| 1654 | ("xpdf %r.pdf &" "%r.pdf") | ||
| 1655 | ("lpr %r.ps" "%r.ps")) | 1660 | ("lpr %r.ps" "%r.ps")) |
| 1656 | "List of commands for `tex-compile'. | 1661 | "List of commands for `tex-compile'. |
| 1657 | Each element should be of the form (FORMAT IN OUT) where | 1662 | Each element should be of the form (FORMAT IN OUT) where |
| @@ -1830,8 +1835,7 @@ FILE is typically the output DVI or PDF file." | |||
| 1830 | (push cmd cmds) | 1835 | (push cmd cmds) |
| 1831 | (push (nth 1 cmd) unchanged-in)))) | 1836 | (push (nth 1 cmd) unchanged-in)))) |
| 1832 | ;; If no command seems to be applicable, arbitrarily pick the first one. | 1837 | ;; If no command seems to be applicable, arbitrarily pick the first one. |
| 1833 | (unless cmds | 1838 | (setq cmds (if cmds (nreverse cmds) (list (car tex-compile-commands)))) |
| 1834 | (setq cmds (list (car tex-compile-commands)))) | ||
| 1835 | ;; Remove those commands whose input was considered stable for | 1839 | ;; Remove those commands whose input was considered stable for |
| 1836 | ;; some other command (typically if (t . "%.pdf") is inactive | 1840 | ;; some other command (typically if (t . "%.pdf") is inactive |
| 1837 | ;; then we're using pdflatex and the fact that the dvi file | 1841 | ;; then we're using pdflatex and the fact that the dvi file |
| @@ -1841,7 +1845,7 @@ FILE is typically the output DVI or PDF file." | |||
| 1841 | (unless (member (nth 1 cmd) unchanged-in) | 1845 | (unless (member (nth 1 cmd) unchanged-in) |
| 1842 | (push cmd tmp))) | 1846 | (push cmd tmp))) |
| 1843 | ;; Only remove if there's something left. | 1847 | ;; Only remove if there's something left. |
| 1844 | (if tmp (setq cmds tmp))) | 1848 | (if tmp (setq cmds (nreverse tmp)))) |
| 1845 | ;; Remove commands whose input is not uptodate either. | 1849 | ;; Remove commands whose input is not uptodate either. |
| 1846 | (let ((outs (delq nil (mapcar (lambda (x) (nth 2 x)) cmds))) | 1850 | (let ((outs (delq nil (mapcar (lambda (x) (nth 2 x)) cmds))) |
| 1847 | (tmp nil)) | 1851 | (tmp nil)) |
| @@ -1849,7 +1853,7 @@ FILE is typically the output DVI or PDF file." | |||
| 1849 | (unless (member (nth 1 cmd) outs) | 1853 | (unless (member (nth 1 cmd) outs) |
| 1850 | (push cmd tmp))) | 1854 | (push cmd tmp))) |
| 1851 | ;; Only remove if there's something left. | 1855 | ;; Only remove if there's something left. |
| 1852 | (if tmp (setq cmds tmp))) | 1856 | (if tmp (setq cmds (nreverse tmp)))) |
| 1853 | ;; Select which file we're going to operate on (the latest). | 1857 | ;; Select which file we're going to operate on (the latest). |
| 1854 | (let ((latest (nth 1 (car cmds)))) | 1858 | (let ((latest (nth 1 (car cmds)))) |
| 1855 | (dolist (cmd (prog1 (cdr cmds) (setq cmds (list (car cmds))))) | 1859 | (dolist (cmd (prog1 (cdr cmds) (setq cmds (list (car cmds))))) |
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index bd14c658379..2be01d630f9 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; texinfo.el --- major mode for editing Texinfo files | 1 | ;;; texinfo.el --- major mode for editing Texinfo files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, | 3 | ;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, |
| 4 | ;; 2000, 2001, 2003, 2004 Free Software Foundation, Inc. | 4 | ;; 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Robert J. Chassell | 6 | ;; Author: Robert J. Chassell |
| 7 | ;; Date: [See date below for texinfo-version] | 7 | ;; Date: [See date below for texinfo-version] |
| @@ -343,11 +343,13 @@ chapter." | |||
| 343 | "Regexp for environment-like Texinfo list commands. | 343 | "Regexp for environment-like Texinfo list commands. |
| 344 | Subexpression 1 is what goes into the corresponding `@end' statement.") | 344 | Subexpression 1 is what goes into the corresponding `@end' statement.") |
| 345 | 345 | ||
| 346 | (defface texinfo-heading-face | 346 | (defface texinfo-heading |
| 347 | '((t (:inherit font-lock-function-name-face))) | 347 | '((t (:inherit font-lock-function-name-face))) |
| 348 | "Face used for section headings in `texinfo-mode'." | 348 | "Face used for section headings in `texinfo-mode'." |
| 349 | :group 'texinfo) | 349 | :group 'texinfo) |
| 350 | (defvar texinfo-heading-face 'texinfo-heading-face) | 350 | ;; backward-compatibility alias |
| 351 | (put 'texinfo-heading-face 'face-alias 'texinfo-heading) | ||
| 352 | (defvar texinfo-heading-face 'texinfo-heading) | ||
| 351 | 353 | ||
| 352 | (defvar texinfo-font-lock-keywords | 354 | (defvar texinfo-font-lock-keywords |
| 353 | `(;; All but the first had an OVERRIDE of t. | 355 | `(;; All but the first had an OVERRIDE of t. |