Mercurial > emacs
comparison lisp/textmodes/org.el @ 69121:39ec690b89d6
(org-xemacs-p, org-export-html-show-new-buffer, org-table-may-need-update,
org-insert-item, org-mhe-get-message-real-folder,
org-mhe-get-message-folder-from-index, org-mhe-get-message-folder,
org-mhe-get-message-num, org-mhe-get-header, org-make-org-heading-search-string,
org-make-org-heading-camel, org-table-sort-lines, org-format-org-table-html,
org-format-table-table-html): Fix typos in docstrings.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Thu, 23 Feb 2006 14:40:40 +0000 |
parents | 79fc120cc4c1 |
children | e80276821f75 34c8b755296d |
comparison
equal
deleted
inserted
replaced
69120:c25ca738fe29 | 69121:39ec690b89d6 |
---|---|
138 | 138 |
139 ;; The following two constants are for compatibility with different Emacs | 139 ;; The following two constants are for compatibility with different Emacs |
140 ;; versions (Emacs versus XEmacs) and with different versions of outline.el. | 140 ;; versions (Emacs versus XEmacs) and with different versions of outline.el. |
141 ;; The compatibility code in org.el is based on these two constants. | 141 ;; The compatibility code in org.el is based on these two constants. |
142 (defconst org-xemacs-p (featurep 'xemacs) | 142 (defconst org-xemacs-p (featurep 'xemacs) |
143 "Are we running xemacs?") | 143 "Are we running XEmacs?") |
144 (defconst org-noutline-p (featurep 'noutline) | 144 (defconst org-noutline-p (featurep 'noutline) |
145 "Are we using the new outline mode?") | 145 "Are we using the new outline mode?") |
146 | 146 |
147 (defgroup org nil | 147 (defgroup org nil |
148 "Outline-based notes management and organizer." | 148 "Outline-based notes management and organizer." |
1649 Otherwise the buffer will just be saved to a file and stay hidden." | 1649 Otherwise the buffer will just be saved to a file and stay hidden." |
1650 :group 'org-export | 1650 :group 'org-export |
1651 :type 'boolean) | 1651 :type 'boolean) |
1652 | 1652 |
1653 (defcustom org-export-html-show-new-buffer nil | 1653 (defcustom org-export-html-show-new-buffer nil |
1654 "Non-nil means, popup buffer containing the exported html text. | 1654 "Non-nil means, popup buffer containing the exported HTML text. |
1655 Otherwise, the buffer will just be saved to a file and stay hidden." | 1655 Otherwise, the buffer will just be saved to a file and stay hidden." |
1656 :group 'org-export | 1656 :group 'org-export |
1657 :type 'boolean) | 1657 :type 'boolean) |
1658 | 1658 |
1659 (defcustom org-combined-agenda-icalendar-file "~/org.ics" | 1659 (defcustom org-combined-agenda-icalendar-file "~/org.ics" |
1997 | 1997 |
1998 ;; We use a before-change function to check if a table might need | 1998 ;; We use a before-change function to check if a table might need |
1999 ;; an update. | 1999 ;; an update. |
2000 (defvar org-table-may-need-update t | 2000 (defvar org-table-may-need-update t |
2001 "Indicates that a table might need an update. | 2001 "Indicates that a table might need an update. |
2002 This variable is set by `org-before-change-function'. `org-table-align' | 2002 This variable is set by `org-before-change-function'. |
2003 sets it back to nil.") | 2003 `org-table-align'sets it back to nil.") |
2004 (defvar org-mode-hook nil) | 2004 (defvar org-mode-hook nil) |
2005 (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | 2005 (defvar org-inhibit-startup nil) ; Dynamically-scoped param. |
2006 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. | 2006 (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. |
2007 | 2007 |
2008 | 2008 |
2658 (insert " ")) | 2658 (insert " ")) |
2659 (run-hooks 'org-insert-heading-hook)))) | 2659 (run-hooks 'org-insert-heading-hook)))) |
2660 | 2660 |
2661 (defun org-insert-item () | 2661 (defun org-insert-item () |
2662 "Insert a new item at the current level. | 2662 "Insert a new item at the current level. |
2663 Return t when tings worked, nil when we are not in an item." | 2663 Return t when things worked, nil when we are not in an item." |
2664 (when (save-excursion | 2664 (when (save-excursion |
2665 (condition-case nil | 2665 (condition-case nil |
2666 (progn | 2666 (progn |
2667 (org-beginning-of-item) | 2667 (org-beginning-of-item) |
2668 (org-at-item-p) | 2668 (org-at-item-p) |
3369 (camel | 3369 (camel |
3370 (setq type :camel) | 3370 (setq type :camel) |
3371 (save-excursion | 3371 (save-excursion |
3372 (goto-char (point-min)) | 3372 (goto-char (point-min)) |
3373 (while (re-search-forward org-todo-line-regexp nil t) | 3373 (while (re-search-forward org-todo-line-regexp nil t) |
3374 (push (list | 3374 (push (list |
3375 (if org-file-link-context-use-camel-case | 3375 (if org-file-link-context-use-camel-case |
3376 (org-make-org-heading-camel (match-string 3) t) | 3376 (org-make-org-heading-camel (match-string 3) t) |
3377 (org-make-org-heading-search-string | 3377 (org-make-org-heading-search-string |
3378 (match-string 3) t))) | 3378 (match-string 3) t))) |
3379 tbl))) | 3379 tbl))) |
6986 (defun org-mark-ring-push (&optional pos buffer) | 6986 (defun org-mark-ring-push (&optional pos buffer) |
6987 "Put the current position or POS into the mark ring and rotate it." | 6987 "Put the current position or POS into the mark ring and rotate it." |
6988 (interactive) | 6988 (interactive) |
6989 (setq pos (or pos (point))) | 6989 (setq pos (or pos (point))) |
6990 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring)) | 6990 (setq org-mark-ring (nthcdr (1- org-mark-ring-length) org-mark-ring)) |
6991 (move-marker (car org-mark-ring) | 6991 (move-marker (car org-mark-ring) |
6992 (or pos (point)) | 6992 (or pos (point)) |
6993 (or buffer (current-buffer))) | 6993 (or buffer (current-buffer))) |
6994 (message | 6994 (message |
6995 (substitute-command-keys | 6995 (substitute-command-keys |
6996 "Position saved to mark ring, go back with \\[org-mark-ring-goto]."))) | 6996 "Position saved to mark ring, go back with \\[org-mark-ring-goto]."))) |
7134 (error "Message not found")))) | 7134 (error "Message not found")))) |
7135 | 7135 |
7136 ;; mh-e integration based on planner-mode | 7136 ;; mh-e integration based on planner-mode |
7137 (defun org-mhe-get-message-real-folder () | 7137 (defun org-mhe-get-message-real-folder () |
7138 "Return the name of the current message real folder, so if you use | 7138 "Return the name of the current message real folder, so if you use |
7139 sequences, it will now work." | 7139 sequences, it will now work." |
7140 (save-excursion | 7140 (save-excursion |
7141 (let* ((folder | 7141 (let* ((folder |
7142 (if (equal major-mode 'mh-folder-mode) | 7142 (if (equal major-mode 'mh-folder-mode) |
7143 mh-current-folder | 7143 mh-current-folder |
7144 ;; Refer to the show buffer | 7144 ;; Refer to the show buffer |
7145 mh-show-folder-buffer)) | 7145 mh-show-folder-buffer)) |
7146 (end-index | 7146 (end-index |
7147 (if (boundp 'mh-index-folder) | 7147 (if (boundp 'mh-index-folder) |
7148 (min (length mh-index-folder) (length folder)))) | 7148 (min (length mh-index-folder) (length folder)))) |
7149 ) | 7149 ) |
7150 ;; a simple test on mh-index-data does not work, because | 7150 ;; a simple test on mh-index-data does not work, because |
7151 ;; mh-index-data is always nil in a show buffer. | 7151 ;; mh-index-data is always nil in a show buffer. |
7164 folder | 7164 folder |
7165 ) | 7165 ) |
7166 ))) | 7166 ))) |
7167 | 7167 |
7168 (defun org-mhe-get-message-folder-from-index () | 7168 (defun org-mhe-get-message-folder-from-index () |
7169 "Returns the name of the message folder in a index folder | 7169 "Returns the name of the message folder in a index folder buffer." |
7170 buffer." | |
7171 (save-excursion | 7170 (save-excursion |
7172 (mh-index-previous-folder) | 7171 (mh-index-previous-folder) |
7173 (if (not (re-search-forward "^\\(+.*\\)$" nil t)) | 7172 (if (not (re-search-forward "^\\(+.*\\)$" nil t)) |
7174 (message "Problem getting folder from index.") | 7173 (message "Problem getting folder from index.") |
7175 (message (match-string 1))))) | 7174 (message (match-string 1))))) |
7176 | 7175 |
7177 (defun org-mhe-get-message-folder () | 7176 (defun org-mhe-get-message-folder () |
7178 "Return the name of the current message folder. Be careful if you | 7177 "Return the name of the current message folder. Be careful if you |
7179 use sequences." | 7178 use sequences." |
7180 (save-excursion | 7179 (save-excursion |
7181 (if (equal major-mode 'mh-folder-mode) | 7180 (if (equal major-mode 'mh-folder-mode) |
7182 mh-current-folder | 7181 mh-current-folder |
7183 ;; Refer to the show buffer | 7182 ;; Refer to the show buffer |
7184 mh-show-folder-buffer))) | 7183 mh-show-folder-buffer))) |
7185 | 7184 |
7186 (defun org-mhe-get-message-num () | 7185 (defun org-mhe-get-message-num () |
7187 "Return the number of the current message. Be careful if you | 7186 "Return the number of the current message. Be careful if you |
7188 use sequences." | 7187 use sequences." |
7189 (save-excursion | 7188 (save-excursion |
7190 (if (equal major-mode 'mh-folder-mode) | 7189 (if (equal major-mode 'mh-folder-mode) |
7191 (mh-get-msg-num nil) | 7190 (mh-get-msg-num nil) |
7192 ;; Refer to the show buffer | 7191 ;; Refer to the show buffer |
7193 (mh-show-buffer-message-number)))) | 7192 (mh-show-buffer-message-number)))) |
7194 | 7193 |
7195 (defun org-mhe-get-header (header) | 7194 (defun org-mhe-get-header (header) |
7196 "Return a header of the message in folder mode. This will create a | 7195 "Return a header of the message in folder mode. This will create a |
7197 show buffer for the corresponding message. If you have a more clever | 7196 show buffer for the corresponding message. If you have a more clever |
7198 idea..." | 7197 idea..." |
7199 (let* ((folder (org-mhe-get-message-folder)) | 7198 (let* ((folder (org-mhe-get-message-folder)) |
7200 (num (org-mhe-get-message-num)) | 7199 (num (org-mhe-get-message-num)) |
7201 (buffer (get-buffer-create (concat "show-" folder))) | 7200 (buffer (get-buffer-create (concat "show-" folder))) |
7202 (header-field)) | 7201 (header-field)) |
7203 (with-current-buffer buffer | 7202 (with-current-buffer buffer |
7220 (let* ((show-buf (concat "show-" folder))) | 7219 (let* ((show-buf (concat "show-" folder))) |
7221 (mh-visit-folder folder) | 7220 (mh-visit-folder folder) |
7222 (get-buffer-create show-buf) | 7221 (get-buffer-create show-buf) |
7223 (mh-show-msg | 7222 (mh-show-msg |
7224 (string-to-number | 7223 (string-to-number |
7225 (car (split-string | 7224 (car (split-string |
7226 (with-temp-buffer | 7225 (with-temp-buffer |
7227 (call-process | 7226 (call-process |
7228 (expand-file-name "pick" mh-progs) | 7227 (expand-file-name "pick" mh-progs) |
7229 nil t nil | 7228 nil t nil |
7230 folder | 7229 folder |
7385 (to-header (org-mhe-get-header "To:")) | 7384 (to-header (org-mhe-get-header "To:")) |
7386 (subject (org-mhe-get-header "Subject:"))) | 7385 (subject (org-mhe-get-header "Subject:"))) |
7387 (setq cpltxt (concat from-header " on: " subject)) | 7386 (setq cpltxt (concat from-header " on: " subject)) |
7388 (setq link (concat cpltxt "\n " | 7387 (setq link (concat cpltxt "\n " |
7389 (org-make-link | 7388 (org-make-link |
7390 "mhe:" (org-mhe-get-message-real-folder) "#" | 7389 "mhe:" (org-mhe-get-message-real-folder) "#" |
7391 (org-remove-angle-brackets | 7390 (org-remove-angle-brackets |
7392 (org-mhe-get-header "Message-Id:"))))))) | 7391 (org-mhe-get-header "Message-Id:"))))))) |
7393 | 7392 |
7394 ((eq major-mode 'rmail-mode) | 7393 ((eq major-mode 'rmail-mode) |
7395 (save-excursion | 7394 (save-excursion |
7493 | 7492 |
7494 ((interactive-p) | 7493 ((interactive-p) |
7495 (error "Cannot link to a buffer which is not visiting a file")) | 7494 (error "Cannot link to a buffer which is not visiting a file")) |
7496 | 7495 |
7497 (t (setq link nil))) | 7496 (t (setq link nil))) |
7498 | 7497 |
7499 (if (and (interactive-p) link) | 7498 (if (and (interactive-p) link) |
7500 (progn | 7499 (progn |
7501 (setq org-stored-links | 7500 (setq org-stored-links |
7502 (cons (cons (or cpltxt link) link) org-stored-links)) | 7501 (cons (cons (or cpltxt link) link) org-stored-links)) |
7503 (message "Stored: %s" (or cpltxt link))) | 7502 (message "Stored: %s" (or cpltxt link))) |
7504 link))) | 7503 link))) |
7505 | 7504 |
7506 (defun org-make-org-heading-search-string (&optional string heading) | 7505 (defun org-make-org-heading-search-string (&optional string heading) |
7507 "Make search string for S or current headline." | 7506 "Make search string for STRING or current headline." |
7508 (interactive) | 7507 (interactive) |
7509 (let ((s (or string (org-get-heading)))) | 7508 (let ((s (or string (org-get-heading)))) |
7510 (unless (and string (not heading)) | 7509 (unless (and string (not heading)) |
7511 ;; We are using a headline, clean up garbage in there. | 7510 ;; We are using a headline, clean up garbage in there. |
7512 (if (string-match org-todo-regexp s) | 7511 (if (string-match org-todo-regexp s) |
7523 (setq s (replace-match " " t t s))) | 7522 (setq s (replace-match " " t t s))) |
7524 (or string (setq s (concat "*" s))) ; Add * for headlines | 7523 (or string (setq s (concat "*" s))) ; Add * for headlines |
7525 (mapconcat 'identity (org-split-string s "[ \t]+") " "))) | 7524 (mapconcat 'identity (org-split-string s "[ \t]+") " "))) |
7526 | 7525 |
7527 (defun org-make-org-heading-camel (&optional string heading) | 7526 (defun org-make-org-heading-camel (&optional string heading) |
7528 "Make a CamelCase string for S or the current headline." | 7527 "Make a CamelCase string for STRING or the current headline." |
7529 (interactive) | 7528 (interactive) |
7530 (let ((s (or string (org-get-heading)))) | 7529 (let ((s (or string (org-get-heading)))) |
7531 (unless (and string (not heading)) | 7530 (unless (and string (not heading)) |
7532 ;; We are using a headline, clean up garbage in there. | 7531 ;; We are using a headline, clean up garbage in there. |
7533 (if (string-match org-todo-regexp s) | 7532 (if (string-match org-todo-regexp s) |
8640 "Sort table lines in region. | 8639 "Sort table lines in region. |
8641 Point and mark define the first and last line to include. Both point and | 8640 Point and mark define the first and last line to include. Both point and |
8642 mark should be in the column that is used for sorting. For example, to | 8641 mark should be in the column that is used for sorting. For example, to |
8643 sort according to column 3, put the mark in the first line to sort, in | 8642 sort according to column 3, put the mark in the first line to sort, in |
8644 table column 3. Put point into the last line to be included in the sorting, | 8643 table column 3. Put point into the last line to be included in the sorting, |
8645 also in table column 3. The command will prompt for the sorting method (n for | 8644 also in table column 3. The command will prompt for the sorting method |
8646 numerical, a for alphanumeric)." | 8645 \(n for numerical, a for alphanumeric)." |
8647 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ") | 8646 (interactive "r\nsSorting method: [n]=numeric [a]=alpha: ") |
8648 (setq numericp (string-match "[nN]" numericp)) | 8647 (setq numericp (string-match "[nN]" numericp)) |
8649 (org-table-align) ;; Just to be safe | 8648 (org-table-align) ;; Just to be safe |
8650 (let* (bcol ecol cmp column lns) | 8649 (let* (bcol ecol cmp column lns) |
8651 (goto-char beg) | 8650 (goto-char beg) |
9480 (setq c (string-to-char (match-string 1 fmt)) | 9479 (setq c (string-to-char (match-string 1 fmt)) |
9481 n (string-to-number (or (match-string 1 fmt) ""))) | 9480 n (string-to-number (or (match-string 1 fmt) ""))) |
9482 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n)) | 9481 (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n)) |
9483 (setq modes (org-set-calc-mode | 9482 (setq modes (org-set-calc-mode |
9484 'calc-float-format | 9483 'calc-float-format |
9485 (list (cdr (assoc c '((?n. float) (?f. fix) | 9484 (list (cdr (assoc c '((?n . float) (?f . fix) |
9486 (?s. sci) (?e. eng)))) | 9485 (?s . sci) (?e . eng)))) |
9487 n)))) | 9486 n)))) |
9488 (setq fmt (replace-match "" t t fmt))) | 9487 (setq fmt (replace-match "" t t fmt))) |
9489 (while (string-match "[DRFS]" fmt) | 9488 (while (string-match "[DRFS]" fmt) |
9490 (setq modes (org-set-calc-mode (match-string 0 fmt))) | 9489 (setq modes (org-set-calc-mode (match-string 0 fmt))) |
9491 (setq fmt (replace-match "" t t fmt))) | 9490 (setq fmt (replace-match "" t t fmt))) |
11002 | 11001 |
11003 | 11002 |
11004 ;; make targets to anchors | 11003 ;; make targets to anchors |
11005 (while (string-match "<<<?\\([^<>]*\\)>>>?[ \t]*\n?" line) | 11004 (while (string-match "<<<?\\([^<>]*\\)>>>?[ \t]*\n?" line) |
11006 (setq line (replace-match | 11005 (setq line (replace-match |
11007 (concat "@<a name=\"" | 11006 (concat "@<a name=\"" |
11008 (org-solidify-link-text (match-string 1 line)) | 11007 (org-solidify-link-text (match-string 1 line)) |
11009 "\">\\nbsp@</a>") | 11008 "\">\\nbsp@</a>") |
11010 t t line))) | 11009 t t line))) |
11011 ;; Replace internal links | 11010 ;; Replace internal links |
11012 (while (string-match org-bracket-link-regexp line) | 11011 (while (string-match org-bracket-link-regexp line) |
11013 (setq line (replace-match | 11012 (setq line (replace-match |
11014 (concat | 11013 (concat |
11015 "@<a href=\"#" | 11014 "@<a href=\"#" |
11016 (org-solidify-link-text (match-string 1 line)) | 11015 (org-solidify-link-text (match-string 1 line)) |
11017 "\">" | 11016 "\">" |
11018 (match-string (if (match-end 3) 3 1) line) | 11017 (match-string (if (match-end 3) 3 1) line) |
11019 "@</a>") | 11018 "@</a>") |
11020 t t line))) | 11019 t t line))) |
11195 (org-format-table-table-html lines) | 11194 (org-format-table-table-html lines) |
11196 ;; Need to use the code generator in table.el, with the original text. | 11195 ;; Need to use the code generator in table.el, with the original text. |
11197 (org-format-table-table-html-using-table-generate-source olines))))) | 11196 (org-format-table-table-html-using-table-generate-source olines))))) |
11198 | 11197 |
11199 (defun org-format-org-table-html (lines) | 11198 (defun org-format-org-table-html (lines) |
11200 "Format a table into html." | 11199 "Format a table into HTML." |
11201 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) | 11200 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) |
11202 (setq lines (nreverse lines)) | 11201 (setq lines (nreverse lines)) |
11203 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) | 11202 (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines))) |
11204 (setq lines (nreverse lines)) | 11203 (setq lines (nreverse lines)) |
11205 (when org-export-table-remove-special-lines | 11204 (when org-export-table-remove-special-lines |
11222 nil ; ignore this line | 11221 nil ; ignore this line |
11223 (and (or (string-match "^[ \t]*|-+\\+" x) | 11222 (and (or (string-match "^[ \t]*|-+\\+" x) |
11224 (string-match "^[ \t]*|[^|]*|" x)) | 11223 (string-match "^[ \t]*|[^|]*|" x)) |
11225 (replace-match "|" t t x)))) | 11224 (replace-match "|" t t x)))) |
11226 lines)))))) | 11225 lines)))))) |
11227 | 11226 |
11228 (let ((head (and org-export-highlight-first-table-line | 11227 (let ((head (and org-export-highlight-first-table-line |
11229 (delq nil (mapcar | 11228 (delq nil (mapcar |
11230 (lambda (x) (string-match "^[ \t]*|-" x)) | 11229 (lambda (x) (string-match "^[ \t]*|-" x)) |
11231 (cdr lines))))) | 11230 (cdr lines))))) |
11232 line fields html) | 11231 line fields html) |
11261 (if (not (eq (aref newstr i) ?|)) | 11260 (if (not (eq (aref newstr i) ?|)) |
11262 (aset newstr i ?\ ))) | 11261 (aset newstr i ?\ ))) |
11263 newstr)) | 11262 newstr)) |
11264 | 11263 |
11265 (defun org-format-table-table-html (lines) | 11264 (defun org-format-table-table-html (lines) |
11266 "Format a table generated by table.el into html. | 11265 "Format a table generated by table.el into HTML. |
11267 This conversion does *not* use `table-generate-source' from table.el. | 11266 This conversion does *not* use `table-generate-source' from table.el. |
11268 This has the advantage that Org-mode's HTML conversions can be used. | 11267 This has the advantage that Org-mode's HTML conversions can be used. |
11269 But it has the disadvantage, that no cell- or row-spanning is allowed." | 11268 But it has the disadvantage, that no cell- or row-spanning is allowed." |
11270 (let (line field-buffer | 11269 (let (line field-buffer |
11271 (head org-export-highlight-first-table-line) | 11270 (head org-export-highlight-first-table-line) |