aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2005-09-23 15:45:39 +0000
committerCarsten Dominik2005-09-23 15:45:39 +0000
commit28e5b05106b37f256eec657ccd34573726d08412 (patch)
tree999b0e59f7025bb9901d54bdf036d9ed5cbcd600
parent8fb7dc777bed8eaeb26741a834775484719b3bc1 (diff)
downloademacs-28e5b05106b37f256eec657ccd34573726d08412.tar.gz
emacs-28e5b05106b37f256eec657ccd34573726d08412.zip
* textmodes/org.el (org-mode-map, orgtbl-mode-map): Move
keybindings with `C-c C-h' prefix to `C-c C-x' prefix. Make use of `remap' feature when available. Additional key bindings for better tty support. (org-mode-restart, org-force-self-insert): New commands. (org-time-stamp-inactive): New command. (org-remap): New function. (org-table-auto-blank-field, org-level-color-stars-only): New options. (org-enable-fixed-width-editor): Moved to `org-structure' customization group. (org-self-insert-command, orgtbl-self-insert-command): Modified to blank field after field motion commands.
-rw-r--r--lisp/textmodes/org.el344
1 files changed, 247 insertions, 97 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index fb8c7949d75..938091d18eb 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar 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.15 8;; Version: 3.16
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.16
84;; - In tables, directly after the field motion commands like TAB and RET,
85;; typing a character will blank the field. Can be turned off with
86;; variable `org-table-auto-blank-field'.
87;; - Inactive timestamps with `C-c !'. These do not trigger the agenda
88;; and are not linked to the calendar.
89;; - Additional key bindings to allow Org-mode to function on a tty emacs.
90;; - `C-c C-h' prefix key replaced by `C-c C-x', and `C-c C-x C-h' replaced
91;; by `C-c C-x b' (b=Browser). This was necessary to recover the
92;; standard meaning of C-h after a prefix key (show prefix bindings).
93;;
83;; Version 3.15 94;; Version 3.15
84;; - QUOTE keyword at the beginning of an entry causes fixed-width export 95;; - QUOTE keyword at the beginning of an entry causes fixed-width export
85;; of unmodified entry text. `C-c :' toggles this keyword. 96;; of unmodified entry text. `C-c :' toggles this keyword.
@@ -199,7 +210,7 @@
199 210
200;;; Customization variables 211;;; Customization variables
201 212
202(defvar org-version "3.15" 213(defvar org-version "3.16"
203 "The version number of the file org.el.") 214 "The version number of the file org.el.")
204(defun org-version () 215(defun org-version ()
205 (interactive) 216 (interactive)
@@ -843,6 +854,13 @@ as possible."
843 :group 'org-structure 854 :group 'org-structure
844 :type 'hook) 855 :type 'hook)
845 856
857(defcustom org-level-color-stars-only nil
858 "Non-nil means fontify only the stars in each headline.
859When nil, the entire headline is fontified.
860After changin this, requires restart of Emacs to become effective."
861 :group 'org-structure
862 :type 'boolean)
863
846(defcustom org-adapt-indentation t 864(defcustom org-adapt-indentation t
847 "Non-nil means, adapt indentation when promoting and demoting. 865 "Non-nil means, adapt indentation when promoting and demoting.
848When this is set and the *entire* text in an entry is indented, the 866When this is set and the *entire* text in an entry is indented, the
@@ -852,6 +870,14 @@ body starts at column 0, indentation is not changed at all."
852 :group 'org-structure 870 :group 'org-structure
853 :type 'boolean) 871 :type 'boolean)
854 872
873(defcustom org-enable-fixed-width-editor t
874 "Non-nil means, lines starting with \":\" are treated as fixed-width.
875This currently only means, they are never auto-wrapped.
876When nil, such lines will be treated like ordinary lines.
877See also the QUOTE keyword."
878 :group 'org-structure
879 :type 'boolean)
880
855(defcustom org-cycle-emulate-tab t 881(defcustom org-cycle-emulate-tab t
856 "Where should `org-cycle' emulate TAB. 882 "Where should `org-cycle' emulate TAB.
857nil Never 883nil Never
@@ -1155,24 +1181,34 @@ do the following
1155 field does not exceed the column width. 1181 field does not exceed the column width.
1156- Minimize the number of realigns. Normally, the table is aligned each time 1182- Minimize the number of realigns. Normally, the table is aligned each time
1157 TAB or RET are pressed to move to another field. With optimization this 1183 TAB or RET are pressed to move to another field. With optimization this
1158 happens only if changes to a field might have changed the column width. 1184 happens only if changes to a field might have changed the column width.
1159Optimization requires replacing the functions `self-insert-command', 1185Optimization requires replacing the functions `self-insert-command',
1160`delete-char', and `backward-delete-char' in Org-mode buffers, with a 1186`delete-char', and `backward-delete-char' in Org-mode buffers, with a
1161slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is 1187slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
1162very good at guessing when a re-align will be necessary, but you can always 1188very good at guessing when a re-align will be necessary, but you can always
1163force one with `C-c C-c'. 1189force one with \\[org-ctrl-c-ctrl-c].
1164 1190
1165If you would like to use the optimized version in Org-mode, but the 1191If you would like to use the optimized version in Org-mode, but the
1166un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'. 1192un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1167 1193
1168This variable can be used to turn on and off the table editor during a session, 1194This variable can be used to turn on and off the table editor during a session,
1169but in order to toggle optimization, a restart is required." 1195but in order to toggle optimization, a restart is required.
1196
1197See also the variable `org-table-auto-blank-field'."
1170 :group 'org-table 1198 :group 'org-table
1171 :type '(choice 1199 :type '(choice
1172 (const :tag "off" nil) 1200 (const :tag "off" nil)
1173 (const :tag "on" t) 1201 (const :tag "on" t)
1174 (const :tag "on, optimized" optimized))) 1202 (const :tag "on, optimized" optimized)))
1175 1203
1204(defcustom org-table-auto-blank-field t
1205 "Non-nil means, automatically blank table field when starting to type into it.
1206This only happens when typing immediately after a field motion
1207command (TAB, S-TAB or RET).
1208Only relevant when `org-enable-table-editor' is equal to `optimized'."
1209 :group 'org-table
1210 :type 'boolean)
1211
1176(defcustom org-table-default-size "5x2" 1212(defcustom org-table-default-size "5x2"
1177 "The default size for newly created tables, Columns x Rows." 1213 "The default size for newly created tables, Columns x Rows."
1178 :group 'org-table 1214 :group 'org-table
@@ -1248,14 +1284,6 @@ calls `table-recognize-table'."
1248 :group 'org-table 1284 :group 'org-table
1249 :type 'boolean) 1285 :type 'boolean)
1250 1286
1251;; FIXME: Should this one be in another group? Which one?
1252(defcustom org-enable-fixed-width-editor t
1253 "Non-nil means, lines starting with \":\" are treated as fixed-width.
1254This currently only means, they are never auto-wrapped.
1255When nil, such lines will be treated like ordinary lines."
1256 :group 'org-table
1257 :type 'boolean)
1258
1259(defgroup org-table-calculation nil 1287(defgroup org-table-calculation nil
1260 "Options concerning tables in Org-mode." 1288 "Options concerning tables in Org-mode."
1261 :tag "Org Table Calculation" 1289 :tag "Org Table Calculation"
@@ -1978,17 +2006,19 @@ The following commands are available:
1978 (append 2006 (append
1979 (if org-noutline-p ; FIXME: I am not sure if eval will work 2007 (if org-noutline-p ; FIXME: I am not sure if eval will work
1980 ; on XEmacs if noutline is ever ported 2008 ; on XEmacs if noutline is ever ported
1981 '((eval . (list "^\\(\\*+\\).*" 2009 `((eval . (list "^\\(\\*+\\).*"
1982 0 '(nth 2010 ,(if org-level-color-stars-only 1 0)
2011 '(nth ;; FIXME: 1<->0 ????
1983 (% (- (match-end 1) (match-beginning 1) 1) 2012 (% (- (match-end 1) (match-beginning 1) 1)
1984 org-n-levels) 2013 org-n-levels)
1985 org-level-faces) 2014 org-level-faces)
1986 nil t))) 2015 nil t)))
1987 '(("^\\(\\(\\*+\\)[^\r\n]*\\)[\n\r]" 2016 `(("^\\(\\(\\*+\\)[^\r\n]*\\)[\n\r]"
1988 (1 (nth (% (- (match-end 2) (match-beginning 2) 1) 2017 (,(if org-level-color-stars-only 2 0)
1989 org-n-levels) 2018 (nth (% (- (match-end 2) (match-beginning 2) 1)
1990 org-level-faces) 2019 org-n-levels)
1991 nil t)))) 2020 org-level-faces)
2021 nil t))))
1992 org-font-lock-extra-keywords)) 2022 org-font-lock-extra-keywords))
1993 (set (make-local-variable 'font-lock-defaults) 2023 (set (make-local-variable 'font-lock-defaults)
1994 '(org-font-lock-keywords t nil nil backward-paragraph)) 2024 '(org-font-lock-keywords t nil nil backward-paragraph))
@@ -2806,7 +2836,7 @@ At all other locations, this simply calls `ispell-complete-word'."
2806 (insert " ")) 2836 (insert " "))
2807 (if (and (equal type :opt) (assoc completion table)) 2837 (if (and (equal type :opt) (assoc completion table))
2808 (message "%s" (substitute-command-keys 2838 (message "%s" (substitute-command-keys
2809 "Press \\[org-complete] again to insert example settings")))) 2839 "Press \\[org-complete] again to insert example settings"))))
2810 (t 2840 (t
2811 (message "Making completion list...") 2841 (message "Making completion list...")
2812 (let ((list (sort (all-completions pattern table) 'string<))) 2842 (let ((list (sort (all-completions pattern table) 'string<)))
@@ -2913,7 +2943,7 @@ to modify it to the correct date."
2913 (format-time-string (car org-time-stamp-formats) 2943 (format-time-string (car org-time-stamp-formats)
2914 (org-read-date nil 'to-time))) 2944 (org-read-date nil 'to-time)))
2915 (message "%s" (substitute-command-keys 2945 (message "%s" (substitute-command-keys
2916 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date."))) 2946 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
2917 2947
2918(defun org-schedule () 2948(defun org-schedule ()
2919 "Insert the SCHEDULED: string to schedule a TODO item. 2949 "Insert the SCHEDULED: string to schedule a TODO item.
@@ -2925,7 +2955,7 @@ to modify it to the correct date."
2925 (format-time-string (car org-time-stamp-formats) 2955 (format-time-string (car org-time-stamp-formats)
2926 (org-read-date nil 'to-time))) 2956 (org-read-date nil 'to-time)))
2927 (message "%s" (substitute-command-keys 2957 (message "%s" (substitute-command-keys
2928 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date."))) 2958 "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
2929 2959
2930 2960
2931(defun org-occur (regexp &optional callback) 2961(defun org-occur (regexp &optional callback)
@@ -3077,6 +3107,21 @@ at the cursor, it will be modified."
3077 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats))) 3107 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
3078 (insert (format-time-string fmt time)))))) 3108 (insert (format-time-string fmt time))))))
3079 3109
3110(defun org-time-stamp-inactive (&optional arg)
3111 "Insert an inactive time stamp.
3112An inactive time stamp is enclosed in square brackets instead of angle
3113brackets. It is inactive in the sense that it does not trigger agenda entries,
3114does not link to the calendar and cannot be changed with the S-cursor keys."
3115 (interactive "P")
3116 (let ((fmt (if arg (cdr org-time-stamp-formats)
3117 (car org-time-stamp-formats)))
3118 (org-time-was-given nil)
3119 time)
3120 (setq time (org-read-date arg 'totime))
3121 (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
3122 (setq fmt (concat "[" (substring fmt 1 -1) "]"))
3123 (insert (format-time-string fmt time))))
3124
3080;;; FIXME: Make the function take "Fri" as "next friday" 3125;;; FIXME: Make the function take "Fri" as "next friday"
3081(defun org-read-date (&optional with-time to-time) 3126(defun org-read-date (&optional with-time to-time)
3082 "Read a date and make things smooth for the user. 3127 "Read a date and make things smooth for the user.
@@ -3539,6 +3584,8 @@ The following commands are available:
3539(define-key org-agenda-mode-map "w" 'org-agenda-week-view) 3584(define-key org-agenda-mode-map "w" 'org-agenda-week-view)
3540(define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later) 3585(define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later)
3541(define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier) 3586(define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier)
3587(define-key org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later)
3588(define-key org-agenda-mode-map [?\C-c ?\C-x (left)] 'org-agenda-date-earlier)
3542 3589
3543(define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) 3590(define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
3544(let ((l '(1 2 3 4 5 6 7 8 9 0))) 3591(let ((l '(1 2 3 4 5 6 7 8 9 0)))
@@ -3574,6 +3621,8 @@ The following commands are available:
3574(define-key org-agenda-mode-map "-" 'org-agenda-priority-down) 3621(define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
3575(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) 3622(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
3576(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) 3623(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
3624(define-key org-agenda-mode-map [?\C-c ?\C-x (up)] 'org-agenda-priority-up)
3625(define-key org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down)
3577(define-key org-agenda-mode-map [(right)] 'org-agenda-later) 3626(define-key org-agenda-mode-map [(right)] 'org-agenda-later)
3578(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier) 3627(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
3579 3628
@@ -6321,7 +6370,8 @@ integer, it will be incremented while copying."
6321 6370
6322(defun org-table-check-inside-data-field () 6371(defun org-table-check-inside-data-field ()
6323 "Is point inside a table data field? 6372 "Is point inside a table data field?
6324I.e. not on a hline or before the first or after the last column?" 6373I.e. not on a hline or before the first or after the last column?
6374This actually throws an error, so it aborts the current command."
6325 (if (or (not (org-at-table-p)) 6375 (if (or (not (org-at-table-p))
6326 (= (org-table-current-column) 0) 6376 (= (org-table-current-column) 0)
6327 (org-at-table-hline-p) 6377 (org-at-table-hline-p)
@@ -7014,13 +7064,10 @@ If NLAST is a number, only the NLAST fields will actually be summed."
7014 (format "%d:%02d:%02d" h m s)))) 7064 (format "%d:%02d:%02d" h m s))))
7015 (kill-new sres) 7065 (kill-new sres)
7016 (if (interactive-p) 7066 (if (interactive-p)
7017 (message "%s" 7067 (message "s"
7018 (concat 7068 (substitute-command-keys
7019 (format "Sum of %d items: %-20s " (length numbers) sres) 7069 (format "Sum of %d items: %-20s (\\[yank] will insert result into buffer)"
7020 (substitute-command-keys 7070 (length numbers) sres))))
7021 "(\\[yank] will insert result into buffer)")
7022 ))
7023 )
7024 sres)))) 7071 sres))))
7025 7072
7026(defun org-table-get-number-for-summing (s) 7073(defun org-table-get-number-for-summing (s)
@@ -7126,7 +7173,7 @@ the current column, to avoid unnecessary parsing."
7126 (stored-list (org-table-get-stored-formulas)) 7173 (stored-list (org-table-get-stored-formulas))
7127 (stored (cdr (assoc scol stored-list))) 7174 (stored (cdr (assoc scol stored-list)))
7128 (eq (cond 7175 (eq (cond
7129 ((and stored equation (string-match "^ *= *$" equation)) 7176 ((and stored equation (string-match "^ *=? *$" equation))
7130 stored) 7177 stored)
7131 ((stringp equation) 7178 ((stringp equation)
7132 equation) 7179 equation)
@@ -7294,7 +7341,7 @@ If yes, store the formula and apply it."
7294 (when org-table-formula-evaluate-inline 7341 (when org-table-formula-evaluate-inline
7295 (let* ((field (org-trim (or (org-table-get-field) ""))) 7342 (let* ((field (org-trim (or (org-table-get-field) "")))
7296 named eq) 7343 named eq)
7297 (when (string-match "^:?=\\(.+\\)" field) 7344 (when (string-match "^:?=\\(.*\\)" field)
7298 (setq named (equal (string-to-char field) ?:) 7345 (setq named (equal (string-to-char field) ?:)
7299 eq (match-string 1 field)) 7346 eq (match-string 1 field))
7300 (if (fboundp 'calc-eval) 7347 (if (fboundp 'calc-eval)
@@ -7916,8 +7963,7 @@ to execute outside of tables."
7916 '("\C-c\M-w" org-table-copy-region) 7963 '("\C-c\M-w" org-table-copy-region)
7917 '("\C-c\C-y" org-table-paste-rectangle) 7964 '("\C-c\C-y" org-table-paste-rectangle)
7918 '("\C-c-" org-table-insert-hline) 7965 '("\C-c-" org-table-insert-hline)
7919 '([(shift tab)] org-table-previous-field) 7966; '([(shift tab)] org-table-previous-field)
7920 '("\C-c\C-c" org-ctrl-c-ctrl-c)
7921 '("\C-m" org-table-next-row) 7967 '("\C-m" org-table-next-row)
7922 (list (org-key 'S-return) 'org-table-copy-down) 7968 (list (org-key 'S-return) 'org-table-copy-down)
7923 '([(meta return)] org-table-wrap-region) 7969 '([(meta return)] org-table-wrap-region)
@@ -7946,16 +7992,18 @@ to execute outside of tables."
7946 (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i")) 7992 (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
7947 (define-key orgtbl-mode-map "\C-i" 7993 (define-key orgtbl-mode-map "\C-i"
7948 (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)]))) 7994 (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)])))
7995 (define-key orgtbl-mode-map "\C-i"
7996 (orgtbl-make-binding 'orgtbl-tab 104 [(shift tab)]))
7997 (define-key orgtbl-mode-map "\C-c\C-c"
7998 (orgtbl-make-binding 'org-ctrl-c-ctrl-c 105 "\C-c\C-c"))
7949 (when orgtbl-optimized 7999 (when orgtbl-optimized
7950 ;; If the user wants maximum table support, we need to hijack 8000 ;; If the user wants maximum table support, we need to hijack
7951 ;; some standard editing functions 8001 ;; some standard editing functions
7952 (substitute-key-definition 'self-insert-command 'orgtbl-self-insert-command 8002 (org-remap orgtbl-mode-map
7953 orgtbl-mode-map global-map) 8003 'self-insert-command 'orgtbl-self-insert-command
7954 (substitute-key-definition 'delete-char 'orgtbl-delete-char 8004 'delete-char 'orgtbl-delete-char
7955 orgtbl-mode-map global-map) 8005 'delete-backward-char 'orgtbl-delete-backward-char)
7956 (substitute-key-definition 'delete-backward-char 'orgtbl-delete-backward-char 8006 (define-key orgtbl-mode-map "|" 'org-force-self-insert))
7957 orgtbl-mode-map global-map)
7958 (define-key org-mode-map "|" 'self-insert-command))
7959 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu" 8007 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
7960 '("OrgTbl" 8008 '("OrgTbl"
7961 ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"] 8009 ["Align" org-ctrl-c-ctrl-c :active (org-at-table-p) :keys "C-c C-c"]
@@ -7980,9 +8028,9 @@ to execute outside of tables."
7980 "--" 8028 "--"
7981 ["Insert Hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"]) 8029 ["Insert Hline" org-table-insert-hline :active (org-at-table-p) :keys "C-c -"])
7982 ("Rectangle" 8030 ("Rectangle"
7983 ["Copy Rectangle" org-copy-special :active (org-at-table-p) :keys "C-c M-w"] 8031 ["Copy Rectangle" org-copy-special :active (org-at-table-p) :keys "C-c C-x M-w"]
7984 ["Cut Rectangle" org-cut-special :active (org-at-table-p) :keys "C-c C-w"] 8032 ["Cut Rectangle" org-cut-special :active (org-at-table-p) :keys "C-c C-x C-w"]
7985 ["Paste Rectangle" org-paste-special :active (org-at-table-p) :keys "C-c C-y"] 8033 ["Paste Rectangle" org-paste-special :active (org-at-table-p) :keys "C-c C-x C-y"]
7986 ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p) :keys "C-c C-q"]) 8034 ["Fill Rectangle" org-table-wrap-region :active (org-at-table-p) :keys "C-c C-q"])
7987 "--" 8035 "--"
7988 ["Set Column Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="] 8036 ["Set Column Formula" org-table-eval-formula :active (org-at-table-p) :keys "C-c ="]
@@ -8018,6 +8066,17 @@ If the cursor is in a table looking at whitespace, the whitespace is
8018overwritten, and the table is not marked as requiring realignment." 8066overwritten, and the table is not marked as requiring realignment."
8019 (interactive "p") 8067 (interactive "p")
8020 (if (and (org-at-table-p) 8068 (if (and (org-at-table-p)
8069 (or
8070 (and org-table-auto-blank-field
8071 (member last-command
8072 '(orgtbl-hijacker-command-100
8073 orgtbl-hijacker-command-101
8074 orgtbl-hijacker-command-102
8075 orgtbl-hijacker-command-103
8076 orgtbl-hijacker-command-104
8077 orgtbl-hijacker-command-105))
8078 (org-table-blank-field))
8079 t)
8021 (eq N 1) 8080 (eq N 1)
8022 (looking-at "[^|\n]* +|")) 8081 (looking-at "[^|\n]* +|"))
8023 (let (org-table-may-need-update) 8082 (let (org-table-may-need-update)
@@ -8029,6 +8088,11 @@ overwritten, and the table is not marked as requiring realignment."
8029 (let (orgtbl-mode) 8088 (let (orgtbl-mode)
8030 (call-interactively (key-binding (vector last-input-event)))))) 8089 (call-interactively (key-binding (vector last-input-event))))))
8031 8090
8091(defun org-force-self-insert (N)
8092 "Needed to enforce self-insert under remapping."
8093 (interactive "p")
8094 (self-insert-command N))
8095
8032(defun orgtbl-delete-backward-char (N) 8096(defun orgtbl-delete-backward-char (N)
8033 "Like `delete-backward-char', insert whitespace at field end in tables. 8097 "Like `delete-backward-char', insert whitespace at field end in tables.
8034When deleting backwards, in tables this function will insert whitespace in 8098When deleting backwards, in tables this function will insert whitespace in
@@ -9344,23 +9408,55 @@ When LEVEL is non-nil, increase section numbers on that level."
9344;; i k @ expendable from outline-mode 9408;; i k @ expendable from outline-mode
9345;; 0123456789 ! %^& ()_{} " `' free 9409;; 0123456789 ! %^& ()_{} " `' free
9346 9410
9347(define-key org-mode-map "\C-i" 'org-cycle) 9411;; TAB key with modifiers
9412(define-key org-mode-map "\C-i" 'org-cycle)
9348(define-key org-mode-map [(meta tab)] 'org-complete) 9413(define-key org-mode-map [(meta tab)] 'org-complete)
9349(define-key org-mode-map "\M-\C-i" 'org-complete) 9414(define-key org-mode-map "\M-\C-i" 'org-complete) ; for tty emacs
9350(define-key org-mode-map [(meta shift left)] 'org-shiftmetaleft) 9415;; The following line is necessary under Suse GNU/Linux
9351(define-key org-mode-map [(meta left)] 'org-metaleft) 9416(unless org-xemacs-p
9352(define-key org-mode-map [(meta shift right)] 'org-shiftmetaright) 9417 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
9353(define-key org-mode-map [(meta shift up)] 'org-shiftmetaup) 9418(define-key org-mode-map [(shift tab)] 'org-shifttab)
9354(define-key org-mode-map [(meta shift down)] 'org-shiftmetadown) 9419
9420(define-key org-mode-map (org-key 'S-return) 'org-table-copy-down)
9421(define-key org-mode-map "\C-c\C-xc" 'org-table-copy-down) ; tty
9422(define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
9423(define-key org-mode-map "\C-c\C-xM" 'org-insert-todo-heading) ; tty
9424(define-key org-mode-map [(meta return)] 'org-meta-return)
9425(define-key org-mode-map "\C-c\C-xm" 'org-meta-return) ; tty emacs
9426(define-key org-mode-map [?\e (return)] 'org-meta-return) ; tty emacs
9427
9428;; Cursor keys with modifiers
9429(define-key org-mode-map [(meta left)] 'org-metaleft)
9430(define-key org-mode-map [?\e (left)] 'org-metaleft) ; for tty emacs
9431(define-key org-mode-map "\C-c\C-xl" 'org-metaleft) ; for tty emacs
9355(define-key org-mode-map [(meta right)] 'org-metaright) 9432(define-key org-mode-map [(meta right)] 'org-metaright)
9356(define-key org-mode-map [(meta up)] 'org-metaup) 9433(define-key org-mode-map [?\e (right)] 'org-metaright) ; for tty emacs
9357(define-key org-mode-map [(meta down)] 'org-metadown) 9434(define-key org-mode-map "\C-c\C-xr" 'org-metaright) ; for tty emacs
9358;(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-subtree) 9435(define-key org-mode-map [(meta up)] 'org-metaup)
9359;(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-subtree) 9436(define-key org-mode-map [?\e (up)] 'org-metaup) ; for tty emacs
9360;(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-subtree) 9437(define-key org-mode-map "\C-c\C-xu" 'org-metaup) ; for tty emacs
9361(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special) 9438(define-key org-mode-map [(meta down)] 'org-metadown)
9362(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special) 9439(define-key org-mode-map [?\e (down)] 'org-metadown) ; for tty emacs
9363(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special) 9440(define-key org-mode-map "\C-c\C-xd" 'org-metadown) ; for tty emacs
9441
9442(define-key org-mode-map [(meta shift left)] 'org-shiftmetaleft)
9443(define-key org-mode-map "\C-c\C-xL" 'org-shiftmetaleft) ; tty
9444(define-key org-mode-map [(meta shift right)] 'org-shiftmetaright)
9445(define-key org-mode-map "\C-c\C-xR" 'org-shiftmetaright) ; tty
9446(define-key org-mode-map [(meta shift up)] 'org-shiftmetaup)
9447(define-key org-mode-map "\C-c\C-xU" 'org-shiftmetaup) ; tty
9448(define-key org-mode-map [(meta shift down)] 'org-shiftmetadown)
9449(define-key org-mode-map "\C-c\C-xD" 'org-shiftmetadown) ; tty
9450(define-key org-mode-map (org-key 'S-up) 'org-shiftup)
9451(define-key org-mode-map [?\C-c ?\C-x (up)] 'org-shiftup)
9452(define-key org-mode-map (org-key 'S-down) 'org-shiftdown)
9453(define-key org-mode-map [?\C-c ?\C-x (down)] 'org-shiftdown)
9454(define-key org-mode-map (org-key 'S-left) 'org-timestamp-down-day)
9455(define-key org-mode-map [?\C-c ?\C-x (left)] 'org-timestamp-down-day)
9456(define-key org-mode-map (org-key 'S-right) 'org-timestamp-up-day)
9457(define-key org-mode-map [?\C-c ?\C-x (right)] 'org-timestamp-up-day)
9458
9459;; All the other keys
9364(define-key org-mode-map "\C-c$" 'org-archive-subtree) 9460(define-key org-mode-map "\C-c$" 'org-archive-subtree)
9365(define-key org-mode-map "\C-c\C-j" 'org-goto) 9461(define-key org-mode-map "\C-c\C-j" 'org-goto)
9366(define-key org-mode-map "\C-c\C-t" 'org-todo) 9462(define-key org-mode-map "\C-c\C-t" 'org-todo)
@@ -9372,11 +9468,11 @@ When LEVEL is non-nil, increase section numbers on that level."
9372(define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved 9468(define-key org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved
9373(define-key org-mode-map "\C-c\C-m" 'org-insert-heading) 9469(define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
9374(define-key org-mode-map "\M-\C-m" 'org-insert-heading) 9470(define-key org-mode-map "\M-\C-m" 'org-insert-heading)
9375(define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
9376(define-key org-mode-map "\C-c\C-l" 'org-insert-link) 9471(define-key org-mode-map "\C-c\C-l" 'org-insert-link)
9377(define-key org-mode-map "\C-c\C-o" 'org-open-at-point) 9472(define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
9378(define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding 9473(define-key org-mode-map "\C-c\C-z" 'org-time-stamp) ; Alternative binding
9379(define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved 9474(define-key org-mode-map "\C-c." 'org-time-stamp) ; Minor-mode reserved
9475(define-key org-mode-map "\C-c!" 'org-time-stamp-inactive) ; Minor-mode r.
9380(define-key org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved 9476(define-key org-mode-map "\C-c," 'org-priority) ; Minor-mode reserved
9381(define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range) 9477(define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
9382(define-key org-mode-map "\C-c>" 'org-goto-calendar) 9478(define-key org-mode-map "\C-c>" 'org-goto-calendar)
@@ -9384,19 +9480,9 @@ When LEVEL is non-nil, increase section numbers on that level."
9384(define-key org-mode-map "\C-c[" 'org-add-file) 9480(define-key org-mode-map "\C-c[" 'org-add-file)
9385(define-key org-mode-map "\C-c]" 'org-remove-file) 9481(define-key org-mode-map "\C-c]" 'org-remove-file)
9386(define-key org-mode-map "\C-c\C-r" 'org-timeline) 9482(define-key org-mode-map "\C-c\C-r" 'org-timeline)
9387(define-key org-mode-map (org-key 'S-up) 'org-shiftup)
9388(define-key org-mode-map (org-key 'S-down) 'org-shiftdown)
9389(define-key org-mode-map (org-key 'S-left) 'org-timestamp-down-day)
9390(define-key org-mode-map (org-key 'S-right) 'org-timestamp-up-day)
9391(define-key org-mode-map "\C-c-" 'org-table-insert-hline) 9483(define-key org-mode-map "\C-c-" 'org-table-insert-hline)
9392;; The following line is necessary for German keyboards under Suse GNU/Linux
9393(unless org-xemacs-p
9394 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
9395(define-key org-mode-map [(shift tab)] 'org-shifttab)
9396(define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) 9484(define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
9397(define-key org-mode-map "\C-m" 'org-return) 9485(define-key org-mode-map "\C-m" 'org-return)
9398(define-key org-mode-map (org-key 'S-return) 'org-table-copy-down)
9399(define-key org-mode-map [(meta return)] 'org-meta-return)
9400(define-key org-mode-map "\C-c?" 'org-table-current-column) 9486(define-key org-mode-map "\C-c?" 'org-table-current-column)
9401(define-key org-mode-map "\C-c " 'org-table-blank-field) 9487(define-key org-mode-map "\C-c " 'org-table-blank-field)
9402(define-key org-mode-map "\C-c+" 'org-table-sum) 9488(define-key org-mode-map "\C-c+" 'org-table-sum)
@@ -9411,12 +9497,18 @@ When LEVEL is non-nil, increase section numbers on that level."
9411(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) 9497(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii)
9412(define-key org-mode-map "\C-c\C-xv" 'org-export-copy-visible) 9498(define-key org-mode-map "\C-c\C-xv" 'org-export-copy-visible)
9413(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-copy-visible) 9499(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-copy-visible)
9500;; OPML support is only planned
9414;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) 9501;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml)
9415;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) 9502;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml)
9416(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) 9503(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
9417(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) 9504(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
9418(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) 9505(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
9419(define-key org-mode-map "\C-c\C-x\C-h" 'org-export-as-html-and-open) 9506(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
9507(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
9508
9509(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
9510(define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
9511(define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
9420 9512
9421(defsubst org-table-p () (org-at-table-p)) 9513(defsubst org-table-p () (org-at-table-p))
9422 9514
@@ -9426,6 +9518,12 @@ If the cursor is in a table looking at whitespace, the whitespace is
9426overwritten, and the table is not marked as requiring realignment." 9518overwritten, and the table is not marked as requiring realignment."
9427 (interactive "p") 9519 (interactive "p")
9428 (if (and (org-table-p) 9520 (if (and (org-table-p)
9521 (or
9522 (and org-table-auto-blank-field
9523 (member last-command
9524 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
9525 (org-table-blank-field))
9526 t)
9429 (eq N 1) 9527 (eq N 1)
9430 (looking-at "[^|\n]* +|")) 9528 (looking-at "[^|\n]* +|"))
9431 (let (org-table-may-need-update) 9529 (let (org-table-may-need-update)
@@ -9480,30 +9578,42 @@ a reduced column width."
9480;; How to do this: Measure non-white length of current string 9578;; How to do this: Measure non-white length of current string
9481;; If equal to column width, we should realign. 9579;; If equal to column width, we should realign.
9482 9580
9581(defun org-remap (map &rest commands)
9582 "In MAP, remap the functions given in COMMANDS.
9583COMMANDS is a list of alternating OLDDEF NEWDEF command names."
9584 (let (new old)
9585 (while commands
9586 (setq old (pop commands) new (pop commands))
9587 (if (fboundp 'command-remapping)
9588 (define-key map (vector 'remap old) new)
9589 (substitute-key-definition old new map global-map)))))
9590
9483(when (eq org-enable-table-editor 'optimized) 9591(when (eq org-enable-table-editor 'optimized)
9484 ;; If the user wants maximum table support, we need to hijack 9592 ;; If the user wants maximum table support, we need to hijack
9485 ;; some standard editing functions 9593 ;; some standard editing functions
9486 (substitute-key-definition 'self-insert-command 'org-self-insert-command 9594 (org-remap org-mode-map
9487 org-mode-map global-map) 9595 'self-insert-command 'org-self-insert-command
9488 (substitute-key-definition 'delete-char 'org-delete-char 9596 'delete-char 'org-delete-char
9489 org-mode-map global-map) 9597 'delete-backward-char 'org-delete-backward-char)
9490 (substitute-key-definition 'delete-backward-char 'org-delete-backward-char 9598 (define-key org-mode-map "|" 'org-force-self-insert))
9491 org-mode-map global-map)
9492 (define-key org-mode-map "|" 'self-insert-command))
9493 9599
9494(defun org-shiftcursor-error () 9600(defun org-shiftcursor-error ()
9495 "Throw an error because Shift-Cursor command was applied in wrong context." 9601 "Throw an error because Shift-Cursor command was applied in wrong context."
9496 (error "This command is only active in tables and on headlines")) 9602 (error "This command is only active in tables and on headlines"))
9497 9603
9498(defun org-shifttab () 9604(defun org-shifttab ()
9499 "Call `(org-cycle t)' or `org-table-previous-field'." 9605 "Global visibility cycling or move to previous table field.
9606Calls `(org-cycle t)' or `org-table-previous-field', depending on context.
9607See the individual commands for more information."
9500 (interactive) 9608 (interactive)
9501 (cond 9609 (cond
9502 ((org-at-table-p) (org-table-previous-field)) 9610 ((org-at-table-p) (org-table-previous-field))
9503 (t (org-cycle '(4))))) 9611 (t (org-cycle '(4)))))
9504 9612
9505(defun org-shiftmetaleft () 9613(defun org-shiftmetaleft ()
9506 "Call `org-promote-subtree' or `org-table-delete-column'." 9614 "Promote subtree or delete table column.
9615Calls `org-promote-subtree' or `org-table-delete-column', depending on context.
9616See the individual commands for more information."
9507 (interactive) 9617 (interactive)
9508 (cond 9618 (cond
9509 ((org-at-table-p) (org-table-delete-column)) 9619 ((org-at-table-p) (org-table-delete-column))
@@ -9511,7 +9621,9 @@ a reduced column width."
9511 (t (org-shiftcursor-error)))) 9621 (t (org-shiftcursor-error))))
9512 9622
9513(defun org-shiftmetaright () 9623(defun org-shiftmetaright ()
9514 "Call `org-demote-subtree' or `org-table-insert-column'." 9624 "Demote subtree or insert table column.
9625Calls `org-demote-subtree' or `org-table-insert-column', depending on context.
9626See the individual commands for more information."
9515 (interactive) 9627 (interactive)
9516 (cond 9628 (cond
9517 ((org-at-table-p) (org-table-insert-column)) 9629 ((org-at-table-p) (org-table-insert-column))
@@ -9519,14 +9631,18 @@ a reduced column width."
9519 (t (org-shiftcursor-error)))) 9631 (t (org-shiftcursor-error))))
9520 9632
9521(defun org-shiftmetaup (&optional arg) 9633(defun org-shiftmetaup (&optional arg)
9522 "Call `org-move-subtree-up' or `org-table-kill-row'." 9634 "Move subtree up or kill table row.
9635Calls `org-move-subtree-up' or `org-table-kill-row', depending on context.
9636See the individual commands for more information."
9523 (interactive "P") 9637 (interactive "P")
9524 (cond 9638 (cond
9525 ((org-at-table-p) (org-table-kill-row)) 9639 ((org-at-table-p) (org-table-kill-row))
9526 ((org-on-heading-p) (org-move-subtree-up arg)) 9640 ((org-on-heading-p) (org-move-subtree-up arg))
9527 (t (org-shiftcursor-error)))) 9641 (t (org-shiftcursor-error))))
9528(defun org-shiftmetadown (&optional arg) 9642(defun org-shiftmetadown (&optional arg)
9529 "Call `org-move-subtree-down' or `org-table-insert-row'." 9643 "Move subtree down or insert table row.
9644Calls `org-move-subtree-down' or `org-table-insert-row', depending on context.
9645See the individual commands for more information."
9530 (interactive "P") 9646 (interactive "P")
9531 (cond 9647 (cond
9532 ((org-at-table-p) (org-table-insert-row arg)) 9648 ((org-at-table-p) (org-table-insert-row arg))
@@ -9534,7 +9650,9 @@ a reduced column width."
9534 (t (org-shiftcursor-error)))) 9650 (t (org-shiftcursor-error))))
9535 9651
9536(defun org-metaleft (&optional arg) 9652(defun org-metaleft (&optional arg)
9537 "Call `org-do-promote' or `org-table-move-column' to left." 9653 "Promote heading or move table column to left.
9654Calls `org-do-promote' or `org-table-move-column', depending on context.
9655See the individual commands for more information."
9538 (interactive "P") 9656 (interactive "P")
9539 (cond 9657 (cond
9540 ((org-at-table-p) (org-table-move-column 'left)) 9658 ((org-at-table-p) (org-table-move-column 'left))
@@ -9542,7 +9660,9 @@ a reduced column width."
9542 (t (backward-word (prefix-numeric-value arg))))) 9660 (t (backward-word (prefix-numeric-value arg)))))
9543 9661
9544(defun org-metaright (&optional arg) 9662(defun org-metaright (&optional arg)
9545 "Call `org-do-demote' or `org-table-move-column' to right." 9663 "Demote subtree or move table column to right.
9664Calls `org-do-demote' or `org-table-move-column', depending on context.
9665See the individual commands for more information."
9546 (interactive "P") 9666 (interactive "P")
9547 (cond 9667 (cond
9548 ((org-at-table-p) (org-table-move-column nil)) 9668 ((org-at-table-p) (org-table-move-column nil))
@@ -9550,7 +9670,9 @@ a reduced column width."
9550 (t (forward-word (prefix-numeric-value arg))))) 9670 (t (forward-word (prefix-numeric-value arg)))))
9551 9671
9552(defun org-metaup (&optional arg) 9672(defun org-metaup (&optional arg)
9553 "Call `org-move-subtree-up' or `org-table-move-row' up." 9673 "Move subtree up or move table row up.
9674Calls `org-move-subtree-up' or `org-table-move-row', depending on context.
9675See the individual commands for more information."
9554 (interactive "P") 9676 (interactive "P")
9555 (cond 9677 (cond
9556 ((org-at-table-p) (org-table-move-row 'up)) 9678 ((org-at-table-p) (org-table-move-row 'up))
@@ -9558,7 +9680,9 @@ a reduced column width."
9558 (t (org-shiftcursor-error)))) 9680 (t (org-shiftcursor-error))))
9559 9681
9560(defun org-metadown (&optional arg) 9682(defun org-metadown (&optional arg)
9561 "Call `org-move-subtree-down' or `org-table-move-row' down." 9683 "Move subtree down or move table row down.
9684Calls `org-move-subtree-down' or `org-table-move-row', depending on context.
9685See the individual commands for more information."
9562 (interactive "P") 9686 (interactive "P")
9563 (cond 9687 (cond
9564 ((org-at-table-p) (org-table-move-row nil)) 9688 ((org-at-table-p) (org-table-move-row nil))
@@ -9566,33 +9690,43 @@ a reduced column width."
9566 (t (org-shiftcursor-error)))) 9690 (t (org-shiftcursor-error))))
9567 9691
9568(defun org-shiftup (&optional arg) 9692(defun org-shiftup (&optional arg)
9569 "Call `org-timestamp-up' or `org-priority-up'." 9693 "Increase item in timestamp or increase priority of current item.
9694Calls `org-timestamp-up' or `org-priority-up', depending on context.
9695See the individual commands for more information."
9570 (interactive "P") 9696 (interactive "P")
9571 (cond 9697 (cond
9572 ((org-at-timestamp-p) (org-timestamp-up arg)) 9698 ((org-at-timestamp-p) (org-timestamp-up arg))
9573 (t (org-priority-up)))) 9699 (t (org-priority-up))))
9574 9700
9575(defun org-shiftdown (&optional arg) 9701(defun org-shiftdown (&optional arg)
9576 "Call `org-timestamp-down' or `org-priority-down'." 9702 "Decrease item in timestamp or decrease priority of current item.
9703Calls `org-timestamp-down' or `org-priority-down', depending on context.
9704See the individual commands for more information."
9577 (interactive "P") 9705 (interactive "P")
9578 (cond 9706 (cond
9579 ((org-at-timestamp-p) (org-timestamp-down arg)) 9707 ((org-at-timestamp-p) (org-timestamp-down arg))
9580 (t (org-priority-down)))) 9708 (t (org-priority-down))))
9581 9709
9582(defun org-copy-special () 9710(defun org-copy-special ()
9583 "Call either `org-table-copy' or `org-copy-subtree'." 9711 "Copy region in table or copy current subtree.
9712Calls `org-table-copy' or `org-copy-subtree', depending on context.
9713See the individual commands for more information."
9584 (interactive) 9714 (interactive)
9585 (call-interactively 9715 (call-interactively
9586 (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree))) 9716 (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree)))
9587 9717
9588(defun org-cut-special () 9718(defun org-cut-special ()
9589 "Call either `org-table-copy' or `org-cut-subtree'." 9719 "Cut region in table or cut current subtree.
9720Calls `org-table-copy' or `org-cut-subtree', depending on context.
9721See the individual commands for more information."
9590 (interactive) 9722 (interactive)
9591 (call-interactively 9723 (call-interactively
9592 (if (org-at-table-p) 'org-table-cut-region 'org-cut-subtree))) 9724 (if (org-at-table-p) 'org-table-cut-region 'org-cut-subtree)))
9593 9725
9594(defun org-paste-special (arg) 9726(defun org-paste-special (arg)
9595 "Call either `org-table-paste-rectangle' or `org-paste-subtree'." 9727 "Paste rectangular region into table, or past subtree relative to level.
9728Calls `org-table-paste-rectangle' or `org-paste-subtree', depending on context.
9729See the individual commands for more information."
9596 (interactive "P") 9730 (interactive "P")
9597 (if (org-at-table-p) 9731 (if (org-at-table-p)
9598 (org-table-paste-rectangle) 9732 (org-table-paste-rectangle)
@@ -9605,7 +9739,8 @@ activate that table. Otherwise, if the cursor is at a normal table
9605created with org.el, re-align that table. This command works even if 9739created with org.el, re-align that table. This command works even if
9606the automatic table editor has been turned off. 9740the automatic table editor has been turned off.
9607If the cursor is in one of the special #+KEYWORD lines, this triggers 9741If the cursor is in one of the special #+KEYWORD lines, this triggers
9608scanning the buffer for these lines and updating the information." 9742scanning the buffer for these lines and updating the information.
9743If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
9609 (interactive "P") 9744 (interactive "P")
9610 (let ((org-enable-table-editor t)) 9745 (let ((org-enable-table-editor t))
9611 (cond 9746 (cond
@@ -9629,7 +9764,7 @@ scanning the buffer for these lines and updating the information."
9629 (skip-chars-backward " \r\n\t") 9764 (skip-chars-backward " \r\n\t")
9630 (if (org-at-table-p) (org-table-recalculate t)))) 9765 (if (org-at-table-p) (org-table-recalculate t))))
9631 (t 9766 (t
9632 (let ((org-inhibit-startup t)) (org-mode))))) 9767 (org-mode-restart))))
9633 ((org-region-active-p) 9768 ((org-region-active-p)
9634 (org-table-convert-region (region-beginning) (region-end) arg)) 9769 (org-table-convert-region (region-beginning) (region-end) arg))
9635 ((and (region-beginning) (region-end)) 9770 ((and (region-beginning) (region-end))
@@ -9638,8 +9773,17 @@ scanning the buffer for these lines and updating the information."
9638 (error "Abort"))) 9773 (error "Abort")))
9639 (t (error "No table at point, and no region to make one"))))) 9774 (t (error "No table at point, and no region to make one")))))
9640 9775
9776(defun org-mode-restart ()
9777 "Restart Org-mode, to scan again for special lines.
9778Also updates the keyword regular expressions."
9779 (interactive)
9780 (let ((org-inhibit-startup t)) (org-mode))
9781 (message "Org-mode restarted to refresh keyword and special line setup"))
9782
9641(defun org-return () 9783(defun org-return ()
9642 "Call `org-table-next-row' or `newline'." 9784 "Goto next table row or insert a newline.
9785Calls `org-table-next-row' or `newline', depending on context.
9786See the individual commands for more information."
9643 (interactive) 9787 (interactive)
9644 (cond 9788 (cond
9645 ((org-at-table-p) 9789 ((org-at-table-p)
@@ -9648,7 +9792,9 @@ scanning the buffer for these lines and updating the information."
9648 (t (newline)))) 9792 (t (newline))))
9649 9793
9650(defun org-meta-return (&optional arg) 9794(defun org-meta-return (&optional arg)
9651 "Call `org-insert-heading' or `org-table-wrap-region'." 9795 "Insert a new heading or wrap a region in a table.
9796Calls `org-insert-heading' or `org-table-wrap-region', depending on context.
9797See the individual commands for more information."
9652 (interactive "P") 9798 (interactive "P")
9653 (cond 9799 (cond
9654 ((org-at-table-p) 9800 ((org-at-table-p)
@@ -9716,6 +9862,7 @@ scanning the buffer for these lines and updating the information."
9716(easy-menu-define org-org-menu org-mode-map "Org menu" 9862(easy-menu-define org-org-menu org-mode-map "Org menu"
9717 '("Org" 9863 '("Org"
9718 ["Cycle Visibility" org-cycle (or (bobp) (outline-on-heading-p))] 9864 ["Cycle Visibility" org-cycle (or (bobp) (outline-on-heading-p))]
9865 ["Cycle Global Visibility" org-shifttab (not (org-at-table-p))]
9719 ["Sparse Tree" org-occur t] 9866 ["Sparse Tree" org-occur t]
9720 ["Show All" show-all t] 9867 ["Show All" show-all t]
9721 "--" 9868 "--"
@@ -9752,6 +9899,7 @@ scanning the buffer for these lines and updating the information."
9752 ["Priority Down" org-shiftdown t]) 9899 ["Priority Down" org-shiftdown t])
9753 ("Dates and Scheduling" 9900 ("Dates and Scheduling"
9754 ["Timestamp" org-time-stamp t] 9901 ["Timestamp" org-time-stamp t]
9902 ["Timestamp (inactive)" org-time-stamp-inactive t]
9755 ("Change Date" 9903 ("Change Date"
9756 ["1 Day Later" org-timestamp-up-day t] 9904 ["1 Day Later" org-timestamp-up-day t]
9757 ["1 Day Earlier" org-timestamp-down-day t] 9905 ["1 Day Earlier" org-timestamp-down-day t]
@@ -9795,6 +9943,8 @@ scanning the buffer for these lines and updating the information."
9795 "--" 9943 "--"
9796 ["Build Full Customize Menu" org-create-customize-menu 9944 ["Build Full Customize Menu" org-create-customize-menu
9797 (fboundp 'customize-menu-create)]) 9945 (fboundp 'customize-menu-create)])
9946 "--"
9947 ["Refresh setup" org-mode-restart t]
9798 )) 9948 ))
9799 9949
9800(defun org-info (&optional node) 9950(defun org-info (&optional node)