aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2007-07-13 13:14:11 +0000
committerCarsten Dominik2007-07-13 13:14:11 +0000
commit1e8fbb6d6d3416ded4347463db7330f01dad07b7 (patch)
treebe09238ec3121b4a5a4252694c5e847e400a2c73
parentd72dd6bc4605c54a6faa19d27f712692d5ed5c01 (diff)
downloademacs-1e8fbb6d6d3416ded4347463db7330f01dad07b7.tar.gz
emacs-1e8fbb6d6d3416ded4347463db7330f01dad07b7.zip
Bug fixes.
-rw-r--r--lisp/textmodes/org.el185
1 files changed, 129 insertions, 56 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 0a7bfc7db0c..22bc3f12bb3 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 5.02 8;; Version: 5.03
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -83,7 +83,7 @@
83 83
84;;; Version 84;;; Version
85 85
86(defconst org-version "5.02" 86(defconst org-version "5.03"
87 "The version number of the file org.el.") 87 "The version number of the file org.el.")
88(defun org-version () 88(defun org-version ()
89 (interactive) 89 (interactive)
@@ -489,15 +489,22 @@ the values `folded', `children', or `subtree'."
489 :tag "Org Edit Structure" 489 :tag "Org Edit Structure"
490 :group 'org-structure) 490 :group 'org-structure)
491 491
492(defcustom org-special-ctrl-a nil 492
493 "Non-nil means `C-a' behaves specially in headlines. 493(defcustom org-special-ctrl-a/e nil
494 "Non-nil means `C-a' and `C-e' behave specially in headlines.
494When set, `C-a' will bring back the cursor to the beginning of the 495When set, `C-a' will bring back the cursor to the beginning of the
495headline text, i.e. after the stars and after a possible TODO keyword. 496headline text, i.e. after the stars and after a possible TODO keyword.
496When the cursor is already at that position, another `C-a' will bring 497When the cursor is already at that position, another `C-a' will bring
497it to the beginning of the line." 498it to the beginning of the line.
499`C-e' will jump to the end of the headline, ignoring the presence of tags
500in the headline. A second `C-e' will then jump to the true end of the
501line, after any tags."
498 :group 'org-edit-structure 502 :group 'org-edit-structure
499 :type 'boolean) 503 :type 'boolean)
500 504
505(if (fboundp 'defvaralias)
506 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
507
501(defcustom org-odd-levels-only nil 508(defcustom org-odd-levels-only nil
502 "Non-nil means, skip even levels and only use odd levels for the outline. 509 "Non-nil means, skip even levels and only use odd levels for the outline.
503This has the effect that two stars are being added/taken away in 510This has the effect that two stars are being added/taken away in
@@ -3408,8 +3415,13 @@ to the part of the headline after the DONE keyword."
3408 '(org-level-1 org-level-2 org-level-3 org-level-4 3415 '(org-level-1 org-level-2 org-level-3 org-level-4
3409 org-level-5 org-level-6 org-level-7 org-level-8 3416 org-level-5 org-level-6 org-level-7 org-level-8
3410 )) 3417 ))
3411(defconst org-n-levels (length org-level-faces))
3412 3418
3419(defcustom org-n-level-faces (length org-level-faces)
3420 "The number different faces to be used for headlines.
3421Org-mode defines 8 different headline faces, so this can be at most 8.
3422If it is less than 8, the level-1 face gets re-used for level N+1 etc."
3423 :type 'number
3424 :group 'org-faces)
3413 3425
3414;;; Variables for pre-computed regular expressions, all buffer local 3426;;; Variables for pre-computed regular expressions, all buffer local
3415 3427
@@ -3686,7 +3698,7 @@ means to push this value onto the list in the variable.")
3686 org-todo-line-regexp 3698 org-todo-line-regexp
3687 (concat "^\\(\\*+\\)[ \t]+\\(?:\\(" 3699 (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
3688 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") 3700 (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
3689 "\\)\\>\\)? *\\(.*\\)") 3701 "\\)\\>\\)?[ \t]*\\(.*\\)")
3690 org-nl-done-regexp 3702 org-nl-done-regexp
3691 (concat "\n\\*+[ \t]+" 3703 (concat "\n\\*+[ \t]+"
3692 "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") 3704 "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|")
@@ -4461,7 +4473,7 @@ between words."
4461 '(org-do-emphasis-faces (0 nil append)) 4473 '(org-do-emphasis-faces (0 nil append))
4462 '(org-do-emphasis-faces))) 4474 '(org-do-emphasis-faces)))
4463 ;; Checkboxes, similar to Frank Ruell's org-checklet.el 4475 ;; Checkboxes, similar to Frank Ruell's org-checklet.el
4464 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" 4476 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)"
4465 2 'bold prepend) 4477 2 'bold prepend)
4466 (if org-provide-checkbox-statistics 4478 (if org-provide-checkbox-statistics
4467 '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" 4479 '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
@@ -4514,7 +4526,7 @@ between words."
4514 "Get the right face for match N in font-lock matching of healdines." 4526 "Get the right face for match N in font-lock matching of healdines."
4515 (setq org-l (- (match-end 2) (match-beginning 1) 1)) 4527 (setq org-l (- (match-end 2) (match-beginning 1) 1))
4516 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) 4528 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
4517 (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces)) 4529 (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces))
4518 (cond 4530 (cond
4519 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) 4531 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
4520 ((eq n 2) org-f) 4532 ((eq n 2) org-f)
@@ -5412,7 +5424,7 @@ If optional TREE is given, use this text instead of the kill ring."
5412 (^re_ (concat "\\(" outline-regexp "\\)[ \t]*")) 5424 (^re_ (concat "\\(" outline-regexp "\\)[ \t]*"))
5413 5425
5414 (old-level (if (string-match ^re txt) 5426 (old-level (if (string-match ^re txt)
5415 (- (match-end 0) (match-beginning 0)) 5427 (- (match-end 0) (match-beginning 0) 1)
5416 -1)) 5428 -1))
5417 (force-level (cond (level (prefix-numeric-value level)) 5429 (force-level (cond (level (prefix-numeric-value level))
5418 ((string-match 5430 ((string-match
@@ -5706,7 +5718,7 @@ Return t when things worked, nil when we are not in an item."
5706 (save-excursion 5718 (save-excursion
5707 (goto-char (match-end 0)) 5719 (goto-char (match-end 0))
5708 (skip-chars-forward " \t") 5720 (skip-chars-forward " \t")
5709 (looking-at "\\[[ X]\\]")))) 5721 (looking-at "\\[[- X]\\]"))))
5710 5722
5711(defun org-toggle-checkbox (&optional arg) 5723(defun org-toggle-checkbox (&optional arg)
5712 "Toggle the checkbox in the current line." 5724 "Toggle the checkbox in the current line."
@@ -5720,7 +5732,11 @@ Return t when things worked, nil when we are not in an item."
5720 (setq beg (point) end (save-excursion (outline-next-heading) (point)))) 5732 (setq beg (point) end (save-excursion (outline-next-heading) (point))))
5721 ((org-at-item-checkbox-p) 5733 ((org-at-item-checkbox-p)
5722 (save-excursion 5734 (save-excursion
5723 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t)) 5735 (replace-match
5736 (cond (arg "[-]")
5737 ((member (match-string 0) '("[ ]" "[-]")) "[X]")
5738 (t "[ ]"))
5739 t t))
5724 (throw 'exit t)) 5740 (throw 'exit t))
5725 (t (error "Not at a checkbox or heading, and no active region"))) 5741 (t (error "Not at a checkbox or heading, and no active region")))
5726 (save-excursion 5742 (save-excursion
@@ -5754,7 +5770,7 @@ the whole buffer."
5754 (end (move-marker (make-marker) 5770 (end (move-marker (make-marker)
5755 (progn (outline-next-heading) (point)))) 5771 (progn (outline-next-heading) (point))))
5756 (re "\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)") 5772 (re "\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)")
5757 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)") 5773 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
5758 b1 e1 f1 c-on c-off lim (cstat 0)) 5774 b1 e1 f1 c-on c-off lim (cstat 0))
5759 (when all 5775 (when all
5760 (goto-char (point-min)) 5776 (goto-char (point-min))
@@ -5774,7 +5790,7 @@ the whole buffer."
5774 (goto-char e1) 5790 (goto-char e1)
5775 (when lim 5791 (when lim
5776 (while (re-search-forward re-box lim t) 5792 (while (re-search-forward re-box lim t)
5777 (if (equal (match-string 2) "[ ]") 5793 (if (member (match-string 2) '("[ ]" "[-]"))
5778 (setq c-off (1+ c-off)) 5794 (setq c-off (1+ c-off))
5779 (setq c-on (1+ c-on)))) 5795 (setq c-on (1+ c-on))))
5780 (delete-region b1 e1) 5796 (delete-region b1 e1)
@@ -7145,7 +7161,7 @@ Optional argument NEW may specify text to replace the current field content."
7145 (setq n (concat new "|") org-table-may-need-update t))) 7161 (setq n (concat new "|") org-table-may-need-update t)))
7146 (or (equal n o) 7162 (or (equal n o)
7147 (let (org-table-may-need-update) 7163 (let (org-table-may-need-update)
7148 (replace-match n)))) 7164 (replace-match n t t))))
7149 (setq org-table-may-need-update t)) 7165 (setq org-table-may-need-update t))
7150 (goto-char pos)))))) 7166 (goto-char pos))))))
7151 7167
@@ -7316,7 +7332,6 @@ is always the old value."
7316 val) 7332 val)
7317 (forward-char 1) "")) 7333 (forward-char 1) ""))
7318 7334
7319
7320(defun org-table-field-info (arg) 7335(defun org-table-field-info (arg)
7321 "Show info about the current field, and highlight any reference at point." 7336 "Show info about the current field, and highlight any reference at point."
7322 (interactive "P") 7337 (interactive "P")
@@ -8723,7 +8738,7 @@ HIGHLIGHT means, just highlight the range."
8723 (goto-line r1) 8738 (goto-line r1)
8724 (while (not (looking-at org-table-dataline-regexp)) 8739 (while (not (looking-at org-table-dataline-regexp))
8725 (beginning-of-line 2)) 8740 (beginning-of-line 2))
8726 (prog1 (org-table-get-field c1) 8741 (prog1 (org-trim (org-table-get-field c1))
8727 (if highlight (org-table-highlight-rectangle (point) (point))))) 8742 (if highlight (org-table-highlight-rectangle (point) (point)))))
8728 ;; A range, return a vector 8743 ;; A range, return a vector
8729 ;; First sort the numbers to get a regular ractangle 8744 ;; First sort the numbers to get a regular ractangle
@@ -8743,7 +8758,8 @@ HIGHLIGHT means, just highlight the range."
8743 (org-table-highlight-rectangle 8758 (org-table-highlight-rectangle
8744 beg (progn (skip-chars-forward "^|\n") (point)))) 8759 beg (progn (skip-chars-forward "^|\n") (point))))
8745 ;; return string representation of calc vector 8760 ;; return string representation of calc vector
8746 (apply 'append (org-table-copy-region beg end)))))) 8761 (mapcar 'org-trim
8762 (apply 'append (org-table-copy-region beg end)))))))
8747 8763
8748(defun org-table-get-descriptor-line (desc &optional cline bline table) 8764(defun org-table-get-descriptor-line (desc &optional cline bline table)
8749 "Analyze descriptor DESC and retrieve the corresponding line number. 8765 "Analyze descriptor DESC and retrieve the corresponding line number.
@@ -9327,10 +9343,10 @@ With prefix ARG, apply the new formulas to the table."
9327 ((looking-at "[ \t]") 9343 ((looking-at "[ \t]")
9328 (goto-char pos) 9344 (goto-char pos)
9329 (call-interactively 'lisp-indent-line)) 9345 (call-interactively 'lisp-indent-line))
9330 ((looking-at "[$@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos)) 9346 ((looking-at "[$&@0-9a-zA-Z]+ *= *[^ \t\n']") (goto-char pos))
9331 ((not (fboundp 'pp-buffer)) 9347 ((not (fboundp 'pp-buffer))
9332 (error "Cannot pretty-print. Command `pp-buffer' is not available.")) 9348 (error "Cannot pretty-print. Command `pp-buffer' is not available."))
9333 ((looking-at "[$@0-9a-zA-Z]+ *= *'(") 9349 ((looking-at "[$&@0-9a-zA-Z]+ *= *'(")
9334 (goto-char (- (match-end 0) 2)) 9350 (goto-char (- (match-end 0) 2))
9335 (setq beg (point)) 9351 (setq beg (point))
9336 (setq ind (make-string (current-column) ?\ )) 9352 (setq ind (make-string (current-column) ?\ ))
@@ -10814,9 +10830,10 @@ With three \\[universal-argument] prefixes, negate the meaning of
10814 (setq link (org-completing-read 10830 (setq link (org-completing-read
10815 "Link: " 10831 "Link: "
10816 (append 10832 (append
10817 (mapcar (lambda (x) (concat (car x) ":")) 10833 (mapcar (lambda (x) (list (concat (car x) ":")))
10818 (append org-link-abbrev-alist-local org-link-abbrev-alist)) 10834 (append org-link-abbrev-alist-local org-link-abbrev-alist))
10819 (mapcar (lambda (x) (concat x ":")) org-link-types)) 10835 (mapcar (lambda (x) (list (concat x ":")))
10836 org-link-types))
10820 nil nil nil 10837 nil nil nil
10821 'tmphist 10838 'tmphist
10822 (or (car (car org-stored-links))))) 10839 (or (car (car org-stored-links)))))
@@ -11810,7 +11827,8 @@ to be run from that hook to fucntion properly."
11810 (org-startup-folded nil) 11827 (org-startup-folded nil)
11811 org-time-was-given org-end-time-was-given x prompt char time) 11828 org-time-was-given org-end-time-was-given x prompt char time)
11812 (setq org-store-link-plist 11829 (setq org-store-link-plist
11813 (append (list :annotation v-a :initial v-i))) 11830 (append (list :annotation v-a :initial v-i)
11831 org-store-link-plist))
11814 (unless tpl (setq tpl "") (message "No template") (ding)) 11832 (unless tpl (setq tpl "") (message "No template") (ding))
11815 (erase-buffer) 11833 (erase-buffer)
11816 (insert (substitute-command-keys 11834 (insert (substitute-command-keys
@@ -13085,6 +13103,29 @@ also TODO lines."
13085(defvar org-tags-overlay (org-make-overlay 1 1)) 13103(defvar org-tags-overlay (org-make-overlay 1 1))
13086(org-detach-overlay org-tags-overlay) 13104(org-detach-overlay org-tags-overlay)
13087 13105
13106(defun org-align-tags-here (to-col)
13107 ;; Assumes that this is a headline
13108 (let ((pos (point)) (col (current-column)) tags)
13109 (beginning-of-line 1)
13110 (if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))
13111 (< pos (match-beginning 2)))
13112 (progn
13113 (setq tags (match-string 2))
13114 (goto-char (match-beginning 1))
13115 (insert " ")
13116 (delete-region (point) (1+ (match-end 0)))
13117 (backward-char 1)
13118 (move-to-column
13119 (max (1+ (current-column))
13120 (1+ col)
13121 (if (> to-col 0)
13122 to-col
13123 (- (abs to-col) (length tags))))
13124 t)
13125 (insert tags)
13126 (move-to-column (min (current-column) col) t))
13127 (goto-char pos))))
13128
13088(defun org-set-tags (&optional arg just-align) 13129(defun org-set-tags (&optional arg just-align)
13089 "Set the tags for the current headline. 13130 "Set the tags for the current headline.
13090With prefix ARG, realign all tags in headings in the current buffer." 13131With prefix ARG, realign all tags in headings in the current buffer."
@@ -13123,30 +13164,31 @@ With prefix ARG, realign all tags in headings in the current buffer."
13123 (while (string-match "[-+&]+" tags) 13164 (while (string-match "[-+&]+" tags)
13124 ;; No boolean logic, just a list 13165 ;; No boolean logic, just a list
13125 (setq tags (replace-match ":" t t tags)))) 13166 (setq tags (replace-match ":" t t tags))))
13126 13167
13127 (if (string-match "\\`[\t ]*\\'" tags) 13168 (if (string-match "\\`[\t ]*\\'" tags)
13128 (setq tags "") 13169 (setq tags "")
13129 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) 13170 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
13130 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) 13171 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
13131 13172
13132 ;; Insert new tags at the correct column 13173 ;; Insert new tags at the correct column
13133 (beginning-of-line 1) 13174 (beginning-of-line 1)
13134 (if (re-search-forward 13175 (cond
13135 (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$") 13176 ((and (equal current "") (equal tags "")))
13136 (point-at-eol) t) 13177 ((re-search-forward
13137 (progn 13178 (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$")
13138 (if (equal tags "") 13179 (point-at-eol) t)
13139 (setq rpl "") 13180 (if (equal tags "")
13140 (goto-char (match-beginning 0)) 13181 (setq rpl "")
13141 (setq c0 (current-column) p0 (point) 13182 (goto-char (match-beginning 0))
13142 c1 (max (1+ c0) (if (> org-tags-column 0) 13183 (setq c0 (current-column) p0 (point)
13143 org-tags-column 13184 c1 (max (1+ c0) (if (> org-tags-column 0)
13144 (- (- org-tags-column) (length tags)))) 13185 org-tags-column
13145 rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) 13186 (- (- org-tags-column) (length tags))))
13146 (replace-match rpl t t) 13187 rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags)))
13147 (and (not (featurep 'xemacs)) c0 (tabify p0 (point))) 13188 (replace-match rpl t t)
13148 tags) 13189 (and (not (featurep 'xemacs)) c0 (tabify p0 (point)))
13149 (error "Tags alignment failed"))))) 13190 tags)
13191 (t (error "Tags alignment failed"))))))
13150 13192
13151(defun org-tags-completion-function (string predicate &optional flag) 13193(defun org-tags-completion-function (string predicate &optional flag)
13152 (let (s1 s2 rtn (ctable org-last-tags-completion-table) 13194 (let (s1 s2 rtn (ctable org-last-tags-completion-table)
@@ -13831,10 +13873,12 @@ This is the compiled version of the format.")
13831 (interactive) 13873 (interactive)
13832 (let* ((fmt org-columns-current-fmt-compiled) 13874 (let* ((fmt org-columns-current-fmt-compiled)
13833 (beg (point-at-bol)) 13875 (beg (point-at-bol))
13876 (level-face (save-excursion
13877 (beginning-of-line 1)
13878 (looking-at "\\(\\**\\)\\(\\* \\)")
13879 (org-get-level-face 2)))
13834 (color (list :foreground 13880 (color (list :foreground
13835 (face-attribute 13881 (face-attribute (or level-face 'default) :foreground)))
13836 (or (get-text-property beg 'face) 'default)
13837 :foreground)))
13838 props pom property ass width f string ov column) 13882 props pom property ass width f string ov column)
13839 ;; Check if the entry is in another buffer. 13883 ;; Check if the entry is in another buffer.
13840 (unless props 13884 (unless props
@@ -18224,8 +18268,8 @@ HH:MM."
18224 18268
18225(defsubst org-cmp-category (a b) 18269(defsubst org-cmp-category (a b)
18226 "Compare the string values of categories of strings A and B." 18270 "Compare the string values of categories of strings A and B."
18227 (let ((ca (or (get-text-property 1 'category a) "")) 18271 (let ((ca (or (get-text-property 1 'org-category a) ""))
18228 (cb (or (get-text-property 1 'category b) ""))) 18272 (cb (or (get-text-property 1 'org-category b) "")))
18229 (cond ((string-lessp ca cb) -1) 18273 (cond ((string-lessp ca cb) -1)
18230 ((string-lessp cb ca) +1) 18274 ((string-lessp cb ca) +1)
18231 (t nil)))) 18275 (t nil))))
@@ -22400,7 +22444,13 @@ overwritten, and the table is not marked as requiring realignment."
22400 (goto-char (match-beginning 0)) 22444 (goto-char (match-beginning 0))
22401 (self-insert-command N)) 22445 (self-insert-command N))
22402 (setq org-table-may-need-update t) 22446 (setq org-table-may-need-update t)
22403 (self-insert-command N))) 22447 (self-insert-command N)
22448 (org-fix-tags-on-the-fly)))
22449
22450(defun org-fix-tags-on-the-fly ()
22451 (when (and (equal (char-after (point-at-bol)) ?*)
22452 (org-on-heading-p))
22453 (org-align-tags-here org-tags-column)))
22404 22454
22405(defun org-delete-backward-char (N) 22455(defun org-delete-backward-char (N)
22406 "Like `delete-backward-char', insert whitespace at field end in tables. 22456 "Like `delete-backward-char', insert whitespace at field end in tables.
@@ -22423,7 +22473,8 @@ because, in this case the deletion might narrow the column."
22423 ;; noalign: if there were two spaces at the end, this field 22473 ;; noalign: if there were two spaces at the end, this field
22424 ;; does not determine the width of the column. 22474 ;; does not determine the width of the column.
22425 (if noalign (setq org-table-may-need-update c))) 22475 (if noalign (setq org-table-may-need-update c)))
22426 (backward-delete-char N))) 22476 (backward-delete-char N)
22477 (org-fix-tags-on-the-fly)))
22427 22478
22428(defun org-delete-char (N) 22479(defun org-delete-char (N)
22429 "Like `delete-char', but insert whitespace at field end in tables. 22480 "Like `delete-char', but insert whitespace at field end in tables.
@@ -22448,7 +22499,8 @@ because, in this case the deletion might narrow the column."
22448 ;; does not determine the width of the column. 22499 ;; does not determine the width of the column.
22449 (if noalign (setq org-table-may-need-update c))) 22500 (if noalign (setq org-table-may-need-update c)))
22450 (delete-char N)) 22501 (delete-char N))
22451 (delete-char N))) 22502 (delete-char N)
22503 (org-fix-tags-on-the-fly)))
22452 22504
22453;; Make `delete-selection-mode' work with org-mode and orgtbl-mode 22505;; Make `delete-selection-mode' work with org-mode and orgtbl-mode
22454(put 'org-self-insert-command 'delete-selection t) 22506(put 'org-self-insert-command 'delete-selection t)
@@ -22884,9 +22936,9 @@ See the individual commands for more information."
22884 "--" 22936 "--"
22885 ["Jump" org-goto t] 22937 ["Jump" org-goto t]
22886 "--" 22938 "--"
22887 ["C-a finds headline start" 22939 ["C-a/e find headline start/end"
22888 (setq org-special-ctrl-a (not org-special-ctrl-a)) 22940 (setq org-special-ctrl-a/e (not org-special-ctrl-a/e))
22889 :style toggle :selected org-special-ctrl-a]) 22941 :style toggle :selected org-special-ctrl-a/e])
22890 ("Edit Structure" 22942 ("Edit Structure"
22891 ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))] 22943 ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))]
22892 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))] 22944 ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
@@ -23434,10 +23486,13 @@ work correctly."
23434 23486
23435;; C-a should go to the beginning of a *visible* line, also in the 23487;; C-a should go to the beginning of a *visible* line, also in the
23436;; new outline.el. I guess this should be patched into Emacs? 23488;; new outline.el. I guess this should be patched into Emacs?
23437(defun org-beginning-of-line () 23489(defun org-beginning-of-line (&optional arg)
23438 "Go to the beginning of the current line. If that is invisible, continue 23490 "Go to the beginning of the current line. If that is invisible, continue
23439to a visible line beginning. This makes the function of C-a more intuitive." 23491to a visible line beginning. This makes the function of C-a more intuitive.
23440 (interactive) 23492If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the
23493first attempt, and only move to after the tags when the cursor is already
23494beyond the end of the headline."
23495 (interactive "P")
23441 (let ((pos (point))) 23496 (let ((pos (point)))
23442 (beginning-of-line 1) 23497 (beginning-of-line 1)
23443 (if (bobp) 23498 (if (bobp)
@@ -23448,14 +23503,32 @@ to a visible line beginning. This makes the function of C-a more intuitive."
23448 (backward-char 1) 23503 (backward-char 1)
23449 (beginning-of-line 1)) 23504 (beginning-of-line 1))
23450 (forward-char 1))) 23505 (forward-char 1)))
23451 (when (and org-special-ctrl-a (looking-at org-todo-line-regexp) 23506 (when (and org-special-ctrl-a/e (looking-at org-todo-line-regexp)
23452 (= (char-after (match-end 1)) ?\ )) 23507 (= (char-after (match-end 1)) ?\ ))
23453 (goto-char 23508 (goto-char
23454 (cond ((> pos (match-beginning 3)) (match-beginning 3)) 23509 (cond ((> pos (match-beginning 3)) (match-beginning 3))
23455 ((= pos (point)) (match-beginning 3)) 23510 ((= pos (point)) (match-beginning 3))
23456 (t (point))))))) 23511 (t (point)))))))
23457 23512
23513(defun org-end-of-line (&optional arg)
23514 "Go to the end of the line.
23515If this is a headline, and `org-special-ctrl-a/e' is set, ignore tags on the
23516first attempt, and only move to after the tags when the cursor is already
23517beyond the end of the headline."
23518 (interactive "P")
23519 (if (or (not org-special-ctrl-a/e)
23520 (not (org-on-heading-p)))
23521 (end-of-line arg)
23522 (let ((pos (point)))
23523 (beginning-of-line 1)
23524 (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))
23525 (if (or (< pos (match-beginning 1))
23526 (= pos (match-end 0)))
23527 (goto-char (match-beginning 1))
23528 (goto-char (match-end 0)))))))
23529
23458(define-key org-mode-map "\C-a" 'org-beginning-of-line) 23530(define-key org-mode-map "\C-a" 'org-beginning-of-line)
23531(define-key org-mode-map "\C-e" 'org-end-of-line)
23459 23532
23460(defun org-invisible-p () 23533(defun org-invisible-p ()
23461 "Check if point is at a character currently not visible." 23534 "Check if point is at a character currently not visible."