Mercurial > emacs
comparison lisp/textmodes/org.el @ 65264:a95981ee377b
(calc-embedded-close-formula, calc-embedded-open-formula,
font-lock-unfontify-region-function): Add defvars.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 31 Aug 2005 10:28:38 +0000 |
parents | d0087dcb8981 |
children | 703495630901 a3716f7538f2 |
comparison
equal
deleted
inserted
replaced
65263:45ef6ad79344 | 65264:a95981ee377b |
---|---|
191 (eval-when-compile (require 'cl) (require 'calendar)) | 191 (eval-when-compile (require 'cl) (require 'calendar)) |
192 (require 'outline) | 192 (require 'outline) |
193 (require 'time-date) | 193 (require 'time-date) |
194 (require 'easymenu) | 194 (require 'easymenu) |
195 | 195 |
196 (defvar calc-embedded-close-formula) | |
197 (defvar calc-embedded-open-formula) | |
198 (defvar font-lock-unfontify-region-function) | |
199 | |
196 ;;; Customization variables | 200 ;;; Customization variables |
197 | 201 |
198 (defvar org-version "3.15" | 202 (defvar org-version "3.15" |
199 "The version number of the file org.el.") | 203 "The version number of the file org.el.") |
200 (defun org-version () | 204 (defun org-version () |
1953 ;; (3 'italic)) | 1957 ;; (3 'italic)) |
1954 ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" | 1958 ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" |
1955 ;; (3 'underline)) | 1959 ;; (3 'underline)) |
1956 ; (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>") | 1960 ; (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>") |
1957 ; '(1 'org-warning t)) | 1961 ; '(1 'org-warning t)) |
1958 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string | 1962 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string |
1959 "\\|" org-quote-string "\\)\\>") | 1963 "\\|" org-quote-string "\\)\\>") |
1960 '(1 'org-special-keyword t)) | 1964 '(1 'org-special-keyword t)) |
1961 '("^#.*" (0 'font-lock-comment-face t)) | 1965 '("^#.*" (0 'font-lock-comment-face t)) |
1962 (if org-fontify-done-headline | 1966 (if org-fontify-done-headline |
1963 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") | 1967 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") |
7034 (* 1.0 (+ h (/ m 60.0) (/ s 3600.0))))) | 7038 (* 1.0 (+ h (/ m 60.0) (/ s 3600.0))))) |
7035 ((equal n 0) nil) | 7039 ((equal n 0) nil) |
7036 (t n)))) | 7040 (t n)))) |
7037 | 7041 |
7038 (defun org-table-get-vertical-vector (desc &optional tbeg col) | 7042 (defun org-table-get-vertical-vector (desc &optional tbeg col) |
7039 "Get a calc vector from a column, accorting to desctiptor DESC. | 7043 "Get a calc vector from a column, accorting to desctiptor DESC. |
7040 Optional arguments TBEG and COL can give the beginning of the table and | 7044 Optional arguments TBEG and COL can give the beginning of the table and |
7041 the current column, to avoid unnecessary parsing." | 7045 the current column, to avoid unnecessary parsing." |
7042 (save-excursion | 7046 (save-excursion |
7043 (or tbeg (setq tbeg (org-table-begin))) | 7047 (or tbeg (setq tbeg (org-table-begin))) |
7044 (or col (setq col (org-table-current-column))) | 7048 (or col (setq col (org-table-current-column))) |
7084 (lambda (x) (setq x (org-trim x)) | 7088 (lambda (x) (setq x (org-trim x)) |
7085 (if (equal x "") "0" x)) | 7089 (if (equal x "") "0" x)) |
7086 l ",") "]")) | 7090 l ",") "]")) |
7087 ((string-match "\\([0-9]+\\)" desc) | 7091 ((string-match "\\([0-9]+\\)" desc) |
7088 (beginning-of-line 1) | 7092 (beginning-of-line 1) |
7089 (when (re-search-backward org-table-dataline-regexp tbeg t | 7093 (when (re-search-backward org-table-dataline-regexp tbeg t |
7090 (string-to-number (match-string 0 desc))) | 7094 (string-to-number (match-string 0 desc))) |
7091 (org-table-goto-column col) | 7095 (org-table-goto-column col) |
7092 (org-trim (org-table-get-field)))))))) | 7096 (org-trim (org-table-get-field)))))))) |
7093 | 7097 |
7094 (defvar org-table-formula-history nil) | 7098 (defvar org-table-formula-history nil) |
7180 (defun org-table-modify-formulas (action &rest columns) | 7184 (defun org-table-modify-formulas (action &rest columns) |
7181 "Modify the formulas stored below the current table. | 7185 "Modify the formulas stored below the current table. |
7182 ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are | 7186 ACTION can be `remove', `insert', `swap'. For `swap', two column numbers are |
7183 expected, for the other action only a single column number is needed." | 7187 expected, for the other action only a single column number is needed." |
7184 (let ((list (org-table-get-stored-formulas)) | 7188 (let ((list (org-table-get-stored-formulas)) |
7185 (nmax (length (org-split-string | 7189 (nmax (length (org-split-string |
7186 (buffer-substring (point-at-bol) (point-at-eol)) | 7190 (buffer-substring (point-at-bol) (point-at-eol)) |
7187 "|"))) | 7191 "|"))) |
7188 col col1 col2 scol si sc1 sc2) | 7192 col col1 col2 scol si sc1 sc2) |
7189 (cond | 7193 (cond |
7190 ((null list)) ; No action needed if there are no stored formulas | 7194 ((null list)) ; No action needed if there are no stored formulas |
7259 (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t) | 7263 (while (re-search-forward "^[ \t]*| *\\([_^]\\) *\\(|.*\\)" end t) |
7260 (setq c (match-string 1) | 7264 (setq c (match-string 1) |
7261 fields (org-split-string (match-string 2) " *| *")) | 7265 fields (org-split-string (match-string 2) " *| *")) |
7262 (save-excursion | 7266 (save-excursion |
7263 (beginning-of-line (if (equal c "_") 2 0)) | 7267 (beginning-of-line (if (equal c "_") 2 0)) |
7264 (setq line (org-current-line) col 1) | 7268 (setq line (org-current-line) col 1) |
7265 (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)") | 7269 (and (looking-at "^[ \t]*|[^|]*\\(|.*\\)") |
7266 (setq fields1 (org-split-string (match-string 1) " *| *")))) | 7270 (setq fields1 (org-split-string (match-string 1) " *| *")))) |
7267 (while (and fields1 (setq field (pop fields))) | 7271 (while (and fields1 (setq field (pop fields))) |
7268 (setq v (pop fields1) col (1+ col)) | 7272 (setq v (pop fields1) col (1+ col)) |
7269 (when (and (stringp field) (stringp v) | 7273 (when (and (stringp field) (stringp v) |
7659 (erase-buffer) | 7663 (erase-buffer) |
7660 (fundamental-mode) | 7664 (fundamental-mode) |
7661 (set (make-local-variable 'org-pos) pos) | 7665 (set (make-local-variable 'org-pos) pos) |
7662 (set (make-local-variable 'org-window-configuration) wc) | 7666 (set (make-local-variable 'org-window-configuration) wc) |
7663 (use-local-map org-edit-formulas-map) | 7667 (use-local-map org-edit-formulas-map) |
7664 (setq s "# Edit formulas and finish with `C-c C-c'. | 7668 (setq s "# Edit formulas and finish with `C-c C-c'. |
7665 # Use `C-u C-c C-c' to also appy them immediately to the entire table. | 7669 # Use `C-u C-c C-c' to also appy them immediately to the entire table. |
7666 # Use `C-c ?' to get information about $name at point. | 7670 # Use `C-c ?' to get information about $name at point. |
7667 # To cancel editing, press `C-c C-q'.\n") | 7671 # To cancel editing, press `C-c C-q'.\n") |
7668 (put-text-property 0 (length s) 'face 'font-lock-comment-face s) | 7672 (put-text-property 0 (length s) 'face 'font-lock-comment-face s) |
7669 (insert s) | 7673 (insert s) |
7697 (message "Named field, column %d of line %d" (nth 2 e) (nth 1 e))) | 7701 (message "Named field, column %d of line %d" (nth 2 e) (nth 1 e))) |
7698 ((setq e (assoc var org-table-column-names)) | 7702 ((setq e (assoc var org-table-column-names)) |
7699 (switch-to-buffer-other-window (marker-buffer pos)) | 7703 (switch-to-buffer-other-window (marker-buffer pos)) |
7700 (goto-char pos) | 7704 (goto-char pos) |
7701 (goto-char (org-table-begin)) | 7705 (goto-char (org-table-begin)) |
7702 (if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|") | 7706 (if (re-search-forward (concat "^[ \t]*| *! *.*?| *\\(" var "\\) *|") |
7703 (org-table-end) t) | 7707 (org-table-end) t) |
7704 (progn | 7708 (progn |
7705 (goto-char (match-beginning 1)) | 7709 (goto-char (match-beginning 1)) |
7706 (message "Named column (column %s)" (cdr e))) | 7710 (message "Named column (column %s)" (cdr e))) |
7707 (error "Column name not found")) | 7711 (error "Column name not found")) |
7752 (unless (org-at-table-p) | 7756 (unless (org-at-table-p) |
7753 (error "Lost table position - cannot install formulae")) | 7757 (error "Lost table position - cannot install formulae")) |
7754 (org-table-store-formulas eql) | 7758 (org-table-store-formulas eql) |
7755 (move-marker pos nil) | 7759 (move-marker pos nil) |
7756 (kill-buffer "*Edit Formulas*") | 7760 (kill-buffer "*Edit Formulas*") |
7757 (if arg | 7761 (if arg |
7758 (org-table-recalculate 'all) | 7762 (org-table-recalculate 'all) |
7759 (message "New formulas installed - press C-u C-c C-c to apply.")))) | 7763 (message "New formulas installed - press C-u C-c C-c to apply.")))) |
7760 | 7764 |
7761 (defun org-abort-edit-formulas () | 7765 (defun org-abort-edit-formulas () |
7762 "Abort editing formulas, without installing the changes." | 7766 "Abort editing formulas, without installing the changes." |
8698 "\\( +\\<" org-quote-string "\\>\\)")) | 8702 "\\( +\\<" org-quote-string "\\>\\)")) |
8699 (replace-match "" t t nil 1) | 8703 (replace-match "" t t nil 1) |
8700 (if (looking-at outline-regexp) | 8704 (if (looking-at outline-regexp) |
8701 (progn | 8705 (progn |
8702 (goto-char (match-end 0)) | 8706 (goto-char (match-end 0)) |
8703 (insert " " org-quote-string)))))))) | 8707 (insert " " org-quote-string)))))))) |
8704 | 8708 |
8705 (defun org-export-as-html-and-open (arg) | 8709 (defun org-export-as-html-and-open (arg) |
8706 "Export the outline as HTML and immediately open it with a browser. | 8710 "Export the outline as HTML and immediately open it with a browser. |
8707 If there is an active region, export only the region. | 8711 If there is an active region, export only the region. |
8708 The prefix ARG specifies how many levels of the outline should become | 8712 The prefix ARG specifies how many levels of the outline should become |