Mercurial > emacs
comparison lisp/textmodes/org.el @ 71563:fca8faa8f94c
(org-mode): Removed no invalid settings for calc embedded
mode.
(org-mode-p): New defsubst.
(org-save-all-org-buffers): New function.
(org-first-headline-recenter): Enclose outline-regexp in group
delimiters.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Mon, 03 Jul 2006 10:24:53 +0000 |
parents | d408779d0af3 |
children | f008b5943ba4 |
comparison
equal
deleted
inserted
replaced
71562:0333fa308fac | 71563:fca8faa8f94c |
---|---|
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. |
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, wp | 6 ;; Keywords: outlines, hypermedia, calendar, wp |
7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
8 ;; Version: 4.41 | 8 ;; Version: 4.42 |
9 ;; | 9 ;; |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 ;; | 11 ;; |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
88 ;; excellent reference card made by Philip Rooke. This card can be found | 88 ;; excellent reference card made by Philip Rooke. This card can be found |
89 ;; in the etc/ directory of Emacs 22. | 89 ;; in the etc/ directory of Emacs 22. |
90 ;; | 90 ;; |
91 ;; Recent changes | 91 ;; Recent changes |
92 ;; -------------- | 92 ;; -------------- |
93 ;; Version 4.42 | |
94 ;; - Bug fixes | |
95 ;; - `s' key in the agenda saves all org-mode buffers. | |
96 ;; | |
93 ;; Version 4.41 | 97 ;; Version 4.41 |
94 ;; - Shift-curser keys can modify inactive time stamps (inactive time | 98 ;; - Shift-curser keys can modify inactive time stamps (inactive time |
95 ;; stamps are the ones in [...] brackets. | 99 ;; stamps are the ones in [...] brackets. |
96 ;; - Toggle all checkboxes in a region/below a headline. | 100 ;; - Toggle all checkboxes in a region/below a headline. |
97 ;; - Bug fixes. | 101 ;; - Bug fixes. |
203 (require 'time-date) | 207 (require 'time-date) |
204 (require 'easymenu) | 208 (require 'easymenu) |
205 | 209 |
206 ;;; Customization variables | 210 ;;; Customization variables |
207 | 211 |
208 (defvar org-version "4.41" | 212 (defvar org-version "4.42" |
209 "The version number of the file org.el.") | 213 "The version number of the file org.el.") |
210 (defun org-version () | 214 (defun org-version () |
211 (interactive) | 215 (interactive) |
212 (message "Org-mode version %s" org-version)) | 216 (message "Org-mode version %s" org-version)) |
213 | 217 |
2685 | 2689 |
2686 (defsubst org-no-properties (s) | 2690 (defsubst org-no-properties (s) |
2687 (remove-text-properties 0 (length s) org-rm-props s) | 2691 (remove-text-properties 0 (length s) org-rm-props s) |
2688 s) | 2692 s) |
2689 | 2693 |
2694 (defsubst org-mode-p () | |
2695 "Check if the current buffer is in Org-mode." | |
2696 (eq major-mode 'org-mode)) | |
2697 | |
2690 (defun org-set-regexps-and-options () | 2698 (defun org-set-regexps-and-options () |
2691 "Precompute regular expressions for current buffer." | 2699 "Precompute regular expressions for current buffer." |
2692 (when (eq major-mode 'org-mode) | 2700 (when (org-mode-p) |
2693 (let ((re (org-make-options-regexp | 2701 (let ((re (org-make-options-regexp |
2694 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" | 2702 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" |
2695 "STARTUP" "ARCHIVE" "TAGS"))) | 2703 "STARTUP" "ARCHIVE" "TAGS"))) |
2696 (splitre "[ \t]+") | 2704 (splitre "[ \t]+") |
2697 kwds int key value cat arch tags) | 2705 kwds int key value cat arch tags) |
2958 ;; Check for running clock before killing a buffer | 2966 ;; Check for running clock before killing a buffer |
2959 (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) | 2967 (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) |
2960 ;; Paragraphs and auto-filling | 2968 ;; Paragraphs and auto-filling |
2961 (org-set-autofill-regexps) | 2969 (org-set-autofill-regexps) |
2962 (org-update-radio-target-regexp) | 2970 (org-update-radio-target-regexp) |
2963 ;; Settings for Calc embedded mode | 2971 |
2964 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n") | |
2965 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n") | |
2966 (if (and org-insert-mode-line-in-empty-file | 2972 (if (and org-insert-mode-line-in-empty-file |
2967 (interactive-p) | 2973 (interactive-p) |
2968 (= (point-min) (point-max))) | 2974 (= (point-min) (point-max))) |
2969 (insert " -*- mode: org -*-\n\n")) | 2975 (insert " -*- mode: org -*-\n\n")) |
2970 | 2976 |
3590 | 3596 |
3591 (defun org-first-headline-recenter (&optional N) | 3597 (defun org-first-headline-recenter (&optional N) |
3592 "Move cursor to the first headline and recenter the headline. | 3598 "Move cursor to the first headline and recenter the headline. |
3593 Optional argument N means, put the headline into the Nth line of the window." | 3599 Optional argument N means, put the headline into the Nth line of the window." |
3594 (goto-char (point-min)) | 3600 (goto-char (point-min)) |
3595 (when (re-search-forward (concat "^" outline-regexp) nil t) | 3601 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t) |
3596 (beginning-of-line) | 3602 (beginning-of-line) |
3597 (recenter (prefix-numeric-value N)))) | 3603 (recenter (prefix-numeric-value N)))) |
3598 | 3604 |
3599 (defvar org-goto-window-configuration nil) | 3605 (defvar org-goto-window-configuration nil) |
3600 (defvar org-goto-marker nil) | 3606 (defvar org-goto-marker nil) |
4518 ;; we need to protect this-command, to avoid kill-region sets it, | 4524 ;; we need to protect this-command, to avoid kill-region sets it, |
4519 ;; which would lead to duplication of subtrees | 4525 ;; which would lead to duplication of subtrees |
4520 (let (this-command) (org-copy-subtree)) | 4526 (let (this-command) (org-copy-subtree)) |
4521 (set-buffer buffer) | 4527 (set-buffer buffer) |
4522 ;; Enforce org-mode for the archive buffer | 4528 ;; Enforce org-mode for the archive buffer |
4523 (if (not (eq major-mode 'org-mode)) | 4529 (if (not (org-mode-p)) |
4524 ;; Force the mode for future visits. | 4530 ;; Force the mode for future visits. |
4525 (let ((org-insert-mode-line-in-empty-file t)) | 4531 (let ((org-insert-mode-line-in-empty-file t)) |
4526 (call-interactively 'org-mode))) | 4532 (call-interactively 'org-mode))) |
4527 (when newfile-p | 4533 (when newfile-p |
4528 (goto-char (point-max)) | 4534 (goto-char (point-max)) |
4853 (error "Not in a dynamic block")))) | 4859 (error "Not in a dynamic block")))) |
4854 | 4860 |
4855 (defun org-update-all-dblocks () | 4861 (defun org-update-all-dblocks () |
4856 "Update all dynamic blocks in the buffer. | 4862 "Update all dynamic blocks in the buffer. |
4857 This function can be used in a hook." | 4863 This function can be used in a hook." |
4858 (when (eq major-mode 'org-mode) | 4864 (when (org-mode-p) |
4859 (org-map-dblocks 'org-update-dblock))) | 4865 (org-map-dblocks 'org-update-dblock))) |
4860 | 4866 |
4861 | 4867 |
4862 ;;; Completion | 4868 ;;; Completion |
4863 | 4869 |
6230 (define-key org-agenda-mode-map "D" 'org-agenda-toggle-diary) | 6236 (define-key org-agenda-mode-map "D" 'org-agenda-toggle-diary) |
6231 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid) | 6237 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid) |
6232 (define-key org-agenda-mode-map "r" 'org-agenda-redo) | 6238 (define-key org-agenda-mode-map "r" 'org-agenda-redo) |
6233 (define-key org-agenda-mode-map "q" 'org-agenda-quit) | 6239 (define-key org-agenda-mode-map "q" 'org-agenda-quit) |
6234 (define-key org-agenda-mode-map "x" 'org-agenda-exit) | 6240 (define-key org-agenda-mode-map "x" 'org-agenda-exit) |
6241 (define-key org-agenda-mode-map "s" 'org-save-all-org-buffers) | |
6235 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority) | 6242 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority) |
6236 (define-key org-agenda-mode-map "T" 'org-agenda-show-tags) | 6243 (define-key org-agenda-mode-map "T" 'org-agenda-show-tags) |
6237 (define-key org-agenda-mode-map "n" 'next-line) | 6244 (define-key org-agenda-mode-map "n" 'next-line) |
6238 (define-key org-agenda-mode-map "p" 'previous-line) | 6245 (define-key org-agenda-mode-map "p" 'previous-line) |
6239 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) | 6246 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) |
6246 '(define-key calendar-mode-map org-calendar-to-agenda-key | 6253 '(define-key calendar-mode-map org-calendar-to-agenda-key |
6247 'org-calendar-goto-agenda)) | 6254 'org-calendar-goto-agenda)) |
6248 (define-key org-agenda-mode-map "C" 'org-agenda-convert-date) | 6255 (define-key org-agenda-mode-map "C" 'org-agenda-convert-date) |
6249 (define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon) | 6256 (define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon) |
6250 (define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon) | 6257 (define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon) |
6251 (define-key org-agenda-mode-map "s" 'org-agenda-sunrise-sunset) | |
6252 (define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) | 6258 (define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) |
6253 (define-key org-agenda-mode-map "h" 'org-agenda-holidays) | 6259 (define-key org-agenda-mode-map "h" 'org-agenda-holidays) |
6254 (define-key org-agenda-mode-map "H" 'org-agenda-holidays) | 6260 (define-key org-agenda-mode-map "H" 'org-agenda-holidays) |
6255 (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) | 6261 (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) |
6256 (define-key org-agenda-mode-map "I" 'org-agenda-clock-in) | 6262 (define-key org-agenda-mode-map "I" 'org-agenda-clock-in) |
6300 ["Decrease Priority" org-agenda-priority-down t] | 6306 ["Decrease Priority" org-agenda-priority-down t] |
6301 ["Show Priority" org-agenda-show-priority t]) | 6307 ["Show Priority" org-agenda-show-priority t]) |
6302 "--" | 6308 "--" |
6303 ;; ["New agenda command" org-agenda t] | 6309 ;; ["New agenda command" org-agenda t] |
6304 ["Rebuild buffer" org-agenda-redo t] | 6310 ["Rebuild buffer" org-agenda-redo t] |
6311 ["Save all Org-mode Buffers" org-save-all-org-buffers t] | |
6305 "--" | 6312 "--" |
6306 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)] | 6313 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)] |
6307 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] | 6314 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] |
6308 ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)] | 6315 ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)] |
6309 "--" | 6316 "--" |
6353 If the current buffer is in Org-mode and visiting a file, you can also | 6360 If the current buffer is in Org-mode and visiting a file, you can also |
6354 first press `1' to indicate that the agenda should be temporarily (until the | 6361 first press `1' to indicate that the agenda should be temporarily (until the |
6355 next use of \\[org-agenda]) restricted to the current file." | 6362 next use of \\[org-agenda]) restricted to the current file." |
6356 (interactive "P") | 6363 (interactive "P") |
6357 (catch 'exit | 6364 (catch 'exit |
6358 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) | 6365 (let ((restrict-ok (and buffer-file-name (org-mode-p))) |
6359 (bfn buffer-file-name) | 6366 (bfn buffer-file-name) |
6360 (custom org-agenda-custom-commands) | 6367 (custom org-agenda-custom-commands) |
6361 c entry key type string) | 6368 c entry key type string) |
6362 (put 'org-agenda-files 'org-restrict nil) | 6369 (put 'org-agenda-files 'org-restrict nil) |
6363 (save-window-excursion | 6370 (save-window-excursion |
6428 (t (error "Invalid custom agenda command type %s" type)))) | 6435 (t (error "Invalid custom agenda command type %s" type)))) |
6429 (t (error "Invalid key")))))) | 6436 (t (error "Invalid key")))))) |
6430 | 6437 |
6431 (defun org-check-for-org-mode () | 6438 (defun org-check-for-org-mode () |
6432 "Make sure current buffer is in org-mode. Error if not." | 6439 "Make sure current buffer is in org-mode. Error if not." |
6433 (or (eq major-mode 'org-mode) | 6440 (or (org-mode-p) |
6434 (error "Cannot execute org-mode agenda command on buffer in %s." | 6441 (error "Cannot execute org-mode agenda command on buffer in %s." |
6435 major-mode))) | 6442 major-mode))) |
6436 | 6443 |
6437 (defun org-fit-agenda-window () | 6444 (defun org-fit-agenda-window () |
6438 "Fit the window to the buffer size." | 6445 "Fit the window to the buffer size." |
6871 (interactive) | 6878 (interactive) |
6872 (org-release-buffers org-agenda-new-buffers) | 6879 (org-release-buffers org-agenda-new-buffers) |
6873 (setq org-agenda-new-buffers nil) | 6880 (setq org-agenda-new-buffers nil) |
6874 (org-agenda-quit)) | 6881 (org-agenda-quit)) |
6875 | 6882 |
6883 ;; FIXME: move this function. | |
6884 (defun org-save-all-org-buffers () | |
6885 "Save all Org-mode buffers without user confirmation." | |
6886 (interactive) | |
6887 (message "Saving all Org-mode buffers...") | |
6888 (save-some-buffers t 'org-mode-p) | |
6889 (message "Saving all Org-mode buffers... done")) | |
6890 | |
6876 (defun org-agenda-redo () | 6891 (defun org-agenda-redo () |
6877 "Rebuild Agenda. | 6892 "Rebuild Agenda. |
6878 When this is the global TODO list, a prefix argument will be interpreted." | 6893 When this is the global TODO list, a prefix argument will be interpreted." |
6879 (interactive) | 6894 (interactive) |
6880 (message "Rebuilding agenda buffer...") | 6895 (message "Rebuilding agenda buffer...") |
7332 arg results rtn) | 7347 arg results rtn) |
7333 (if (not buffer) | 7348 (if (not buffer) |
7334 ;; If file does not exist, make sure an error message ends up in diary | 7349 ;; If file does not exist, make sure an error message ends up in diary |
7335 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file)) | 7350 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file)) |
7336 (with-current-buffer buffer | 7351 (with-current-buffer buffer |
7337 (unless (eq major-mode 'org-mode) | 7352 (unless (org-mode-p) |
7338 (error "Agenda file %s is not in `org-mode'" file)) | 7353 (error "Agenda file %s is not in `org-mode'" file)) |
7339 (setq org-category-table (org-get-category-table)) | 7354 (setq org-category-table (org-get-category-table)) |
7340 (let ((case-fold-search nil)) | 7355 (let ((case-fold-search nil)) |
7341 (save-excursion | 7356 (save-excursion |
7342 (save-restriction | 7357 (save-restriction |
8004 (buffer (marker-buffer marker)) | 8019 (buffer (marker-buffer marker)) |
8005 (pos (marker-position marker))) | 8020 (pos (marker-position marker))) |
8006 (switch-to-buffer-other-window buffer) | 8021 (switch-to-buffer-other-window buffer) |
8007 (widen) | 8022 (widen) |
8008 (goto-char pos) | 8023 (goto-char pos) |
8009 (when (eq major-mode 'org-mode) | 8024 (when (org-mode-p) |
8010 (org-show-hidden-entry) | 8025 (org-show-hidden-entry) |
8011 (save-excursion | 8026 (save-excursion |
8012 (and (outline-next-heading) | 8027 (and (outline-next-heading) |
8013 (org-flag-heading nil)))) ; show the next heading | 8028 (org-flag-heading nil)))) ; show the next heading |
8014 (and highlight (org-highlight (point-at-bol) (point-at-eol))))) | 8029 (and highlight (org-highlight (point-at-bol) (point-at-eol))))) |
8022 (pos (marker-position marker))) | 8037 (pos (marker-position marker))) |
8023 (switch-to-buffer buffer) | 8038 (switch-to-buffer buffer) |
8024 (delete-other-windows) | 8039 (delete-other-windows) |
8025 (widen) | 8040 (widen) |
8026 (goto-char pos) | 8041 (goto-char pos) |
8027 (when (eq major-mode 'org-mode) | 8042 (when (org-mode-p) |
8028 (org-show-hidden-entry) | 8043 (org-show-hidden-entry) |
8029 (save-excursion | 8044 (save-excursion |
8030 (and (outline-next-heading) | 8045 (and (outline-next-heading) |
8031 (org-flag-heading nil)))))) ; show the next heading | 8046 (org-flag-heading nil)))))) ; show the next heading |
8032 | 8047 |
8615 ;; If file does not exist, merror message to agenda | 8630 ;; If file does not exist, merror message to agenda |
8616 (setq rtn (list | 8631 (setq rtn (list |
8617 (format "ORG-AGENDA-ERROR: No such org-file %s" file)) | 8632 (format "ORG-AGENDA-ERROR: No such org-file %s" file)) |
8618 rtnall (append rtnall rtn)) | 8633 rtnall (append rtnall rtn)) |
8619 (with-current-buffer buffer | 8634 (with-current-buffer buffer |
8620 (unless (eq major-mode 'org-mode) | 8635 (unless (org-mode-p) |
8621 (error "Agenda file %s is not in `org-mode'" file)) | 8636 (error "Agenda file %s is not in `org-mode'" file)) |
8622 (setq org-category-table (org-get-category-table)) | 8637 (setq org-category-table (org-get-category-table)) |
8623 (save-excursion | 8638 (save-excursion |
8624 (save-restriction | 8639 (save-restriction |
8625 (if org-respect-restriction | 8640 (if org-respect-restriction |
9142 ;; There is an exact target for this | 9157 ;; There is an exact target for this |
9143 (goto-char pos)) | 9158 (goto-char pos)) |
9144 ((string-match "^/\\(.*\\)/$" s) | 9159 ((string-match "^/\\(.*\\)/$" s) |
9145 ;; A regular expression | 9160 ;; A regular expression |
9146 (cond | 9161 (cond |
9147 ((eq major-mode 'org-mode) | 9162 ((org-mode-p) |
9148 (org-occur (match-string 1 s))) | 9163 (org-occur (match-string 1 s))) |
9149 ;;((eq major-mode 'dired-mode) | 9164 ;;((eq major-mode 'dired-mode) |
9150 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) | 9165 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) |
9151 (t (org-do-occur (match-string 1 s))))) | 9166 (t (org-do-occur (match-string 1 s))))) |
9152 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s)) | 9167 ((or (setq camel (string-match (concat "^" org-camel-regexp "$") s)) |
9198 ;; Normal string-search | 9213 ;; Normal string-search |
9199 (goto-char (point-min)) | 9214 (goto-char (point-min)) |
9200 (if (search-forward s nil t) | 9215 (if (search-forward s nil t) |
9201 (goto-char (match-beginning 0)) | 9216 (goto-char (match-beginning 0)) |
9202 (error "No match")))) | 9217 (error "No match")))) |
9203 (and (eq major-mode 'org-mode) (org-show-hierarchy-above)))) | 9218 (and (org-mode-p) (org-show-hierarchy-above)))) |
9204 | 9219 |
9205 (defun org-search-not-link (&rest args) | 9220 (defun org-search-not-link (&rest args) |
9206 "Execute `re-search-forward', but only accept matches that are not a link." | 9221 "Execute `re-search-forward', but only accept matches that are not a link." |
9207 (catch 'exit | 9222 (catch 'exit |
9208 (let (p1) | 9223 (let (p1) |
9652 (if line (goto-line line) | 9667 (if line (goto-line line) |
9653 (if search (org-link-search search)))) | 9668 (if search (org-link-search search)))) |
9654 ((consp cmd) | 9669 ((consp cmd) |
9655 (eval cmd)) | 9670 (eval cmd)) |
9656 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) | 9671 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) |
9657 (and (eq major-mode 'org-mode) (eq old-mode 'org-mode) | 9672 (and (org-mode-p) (eq old-mode 'org-mode) |
9658 (or (not (equal old-buffer (current-buffer))) | 9673 (or (not (equal old-buffer (current-buffer))) |
9659 (not (equal old-pos (point)))) | 9674 (not (equal old-pos (point)))) |
9660 (org-mark-ring-push old-pos old-buffer)))) | 9675 (org-mark-ring-push old-pos old-buffer)))) |
9661 | 9676 |
9662 (defun org-default-apps () | 9677 (defun org-default-apps () |
9831 ((eq major-mode 'image-mode) | 9846 ((eq major-mode 'image-mode) |
9832 (setq cpltxt (concat "file:" | 9847 (setq cpltxt (concat "file:" |
9833 (abbreviate-file-name buffer-file-name)) | 9848 (abbreviate-file-name buffer-file-name)) |
9834 link (org-make-link cpltxt))) | 9849 link (org-make-link cpltxt))) |
9835 | 9850 |
9836 ((eq major-mode 'org-mode) | 9851 ((org-mode-p) |
9837 ;; Just link to current headline | 9852 ;; Just link to current headline |
9838 (setq cpltxt (concat "file:" | 9853 (setq cpltxt (concat "file:" |
9839 (abbreviate-file-name buffer-file-name))) | 9854 (abbreviate-file-name buffer-file-name))) |
9840 ;; Add a context search string | 9855 ;; Add a context search string |
9841 (when (org-xor org-context-in-file-links arg) | 9856 (when (org-xor org-context-in-file-links arg) |
10676 (delete-region beg end) | 10691 (delete-region beg end) |
10677 (move-marker end nil) | 10692 (move-marker end nil) |
10678 (move-marker org-table-aligned-begin-marker (point)) | 10693 (move-marker org-table-aligned-begin-marker (point)) |
10679 (insert new) | 10694 (insert new) |
10680 (move-marker org-table-aligned-end-marker (point)) | 10695 (move-marker org-table-aligned-end-marker (point)) |
10681 (when (and orgtbl-mode (not (eq major-mode 'org-mode))) | 10696 (when (and orgtbl-mode (not (org-mode-p))) |
10682 (goto-char org-table-aligned-begin-marker) | 10697 (goto-char org-table-aligned-begin-marker) |
10683 (while (org-hide-wide-columns org-table-aligned-end-marker))) | 10698 (while (org-hide-wide-columns org-table-aligned-end-marker))) |
10684 ;; Try to move to the old location (approximately) | 10699 ;; Try to move to the old location (approximately) |
10685 (goto-line linepos) | 10700 (goto-line linepos) |
10686 (set-window-start (selected-window) winstart 'noforce) | 10701 (set-window-start (selected-window) winstart 'noforce) |
12442 | 12457 |
12443 ;;;###autoload | 12458 ;;;###autoload |
12444 (defun orgtbl-mode (&optional arg) | 12459 (defun orgtbl-mode (&optional arg) |
12445 "The `org-mode' table editor as a minor mode for use in other modes." | 12460 "The `org-mode' table editor as a minor mode for use in other modes." |
12446 (interactive) | 12461 (interactive) |
12447 (if (eq major-mode 'org-mode) | 12462 (if (org-mode-p) |
12448 ;; Exit without error, in case some hook functions calls this | 12463 ;; Exit without error, in case some hook functions calls this |
12449 ;; by accident in org-mode. | 12464 ;; by accident in org-mode. |
12450 (message "Orgtbl-mode is not useful in org-mode, command ignored") | 12465 (message "Orgtbl-mode is not useful in org-mode, command ignored") |
12451 (setq orgtbl-mode | 12466 (setq orgtbl-mode |
12452 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) | 12467 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) |
14873 en embedded LaTeX fragement, let texmathp do its job. | 14888 en embedded LaTeX fragement, let texmathp do its job. |
14874 \\[org-cdlatex-mode-map]" | 14889 \\[org-cdlatex-mode-map]" |
14875 (interactive) | 14890 (interactive) |
14876 (let (p) | 14891 (let (p) |
14877 (cond | 14892 (cond |
14878 ((not (eq major-mode 'org-mode)) ad-do-it) | 14893 ((not (org-mode-p)) ad-do-it) |
14879 ((eq this-command 'cdlatex-math-symbol) | 14894 ((eq this-command 'cdlatex-math-symbol) |
14880 (setq ad-return-value t | 14895 (setq ad-return-value t |
14881 texmathp-why '("cdlatex-math-symbol in org-mode" . 0))) | 14896 texmathp-why '("cdlatex-math-symbol in org-mode" . 0))) |
14882 (t | 14897 (t |
14883 (let ((p (org-inside-LaTeX-fragment-p))) | 14898 (let ((p (org-inside-LaTeX-fragment-p))) |
15832 (defun org-install-agenda-files-menu () | 15847 (defun org-install-agenda-files-menu () |
15833 (let ((bl (buffer-list))) | 15848 (let ((bl (buffer-list))) |
15834 (save-excursion | 15849 (save-excursion |
15835 (while bl | 15850 (while bl |
15836 (set-buffer (pop bl)) | 15851 (set-buffer (pop bl)) |
15837 (if (eq major-mode 'org-mode) (setq bl nil))) | 15852 (if (org-mode-p) (setq bl nil))) |
15838 (when (eq major-mode 'org-mode) | 15853 (when (org-mode-p) |
15839 (easy-menu-change | 15854 (easy-menu-change |
15840 '("Org") "File List for Agenda" | 15855 '("Org") "File List for Agenda" |
15841 (append | 15856 (append |
15842 (list | 15857 (list |
15843 ["Edit File List" (org-edit-agenda-file-list) t] | 15858 ["Edit File List" (org-edit-agenda-file-list) t] |
16334 "Make the position visible." | 16349 "Make the position visible." |
16335 (org-bookmark-jump-unhide)))) | 16350 (org-bookmark-jump-unhide)))) |
16336 | 16351 |
16337 (defun org-bookmark-jump-unhide () | 16352 (defun org-bookmark-jump-unhide () |
16338 "Unhide the current position, to show the bookmark location." | 16353 "Unhide the current position, to show the bookmark location." |
16339 (and (eq major-mode 'org-mode) | 16354 (and (org-mode-p) |
16340 (or (org-invisible-p) | 16355 (or (org-invisible-p) |
16341 (save-excursion (goto-char (max (point-min) (1- (point)))) | 16356 (save-excursion (goto-char (max (point-min) (1- (point)))) |
16342 (org-invisible-p))) | 16357 (org-invisible-p))) |
16343 (org-show-hierarchy-above))) | 16358 (org-show-hierarchy-above))) |
16344 | 16359 |
16345 ;;; Experimental code | 16360 ;;; Experimental code |
16346 | 16361 |
16362 | |
16347 ;;; Finish up | 16363 ;;; Finish up |
16348 | 16364 |
16349 (provide 'org) | 16365 (provide 'org) |
16350 | 16366 |
16351 (run-hooks 'org-load-hook) | 16367 (run-hooks 'org-load-hook) |