aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2005-10-10 09:16:22 +0000
committerCarsten Dominik2005-10-10 09:16:22 +0000
commit1d676e9fe3ee65ba26c299809d1a16cde2b6ac1b (patch)
tree9791c63f7e3205de8eb3438e72b0c45a1943bbc2
parent1fb7ce77dfbd0ac5ca9bdfdc53518148ae1b4012 (diff)
downloademacs-1d676e9fe3ee65ba26c299809d1a16cde2b6ac1b.tar.gz
emacs-1d676e9fe3ee65ba26c299809d1a16cde2b6ac1b.zip
(org-mode-map): Explicit definition of `C-c C-x' as a
prefix. (orgtbl-mode-map): Full keymap instead of sparse, because all `self-insert-command' keys are redifined in this map. (org-export-as-html): Specify charset for HTML file, by taking it from the coding system.
-rw-r--r--lisp/textmodes/org.el191
1 files changed, 102 insertions, 89 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index f10e546d00b..b9542c9fce7 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.16 8;; Version: 3.17
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -80,6 +80,9 @@
80;; 80;;
81;; Changes: 81;; Changes:
82;; ------- 82;; -------
83;; Version 3.17
84;; - HTML export specifies character set depending on coding-system.
85;;
83;; Version 3.16 86;; Version 3.16
84;; - In tables, directly after the field motion commands like TAB and RET, 87;; - 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 88;; typing a character will blank the field. Can be turned off with
@@ -210,7 +213,7 @@
210 213
211;;; Customization variables 214;;; Customization variables
212 215
213(defvar org-version "3.16" 216(defvar org-version "3.17"
214 "The version number of the file org.el.") 217 "The version number of the file org.el.")
215(defun org-version () 218(defun org-version ()
216 (interactive) 219 (interactive)
@@ -482,89 +485,6 @@ or contain a special line
482If the file does not specify a category, then file's base name 485If the file does not specify a category, then file's base name
483is used instead.") 486is used instead.")
484 487
485(defun org-set-regexps-and-options ()
486 "Precompute regular expressions for current buffer."
487 (when (eq major-mode 'org-mode)
488 (let ((re (org-make-options-regexp
489 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
490 "STARTUP" "ARCHIVE")))
491 (splitre "[ \t]+")
492 kwds int key value cat arch)
493 (save-excursion
494 (save-restriction
495 (widen)
496 (goto-char (point-min))
497 (while (re-search-forward re nil t)
498 (setq key (match-string 1) value (match-string 2))
499 (cond
500 ((equal key "CATEGORY")
501 (if (string-match "[ \t]+$" value)
502 (setq value (replace-match "" t t value)))
503 (setq cat (intern value)))
504 ((equal key "SEQ_TODO")
505 (setq int 'sequence
506 kwds (append kwds (org-split-string value splitre))))
507 ((equal key "PRI_TODO")
508 (setq int 'priority
509 kwds (append kwds (org-split-string value splitre))))
510 ((equal key "TYP_TODO")
511 (setq int 'type
512 kwds (append kwds (org-split-string value splitre))))
513 ((equal key "STARTUP")
514 (let ((opts (org-split-string value splitre))
515 (set '(("fold" org-startup-folded t)
516 ("nofold" org-startup-folded nil)
517 ("content" org-startup-folded content)
518 ("dlcheck" org-startup-with-deadline-check t)
519 ("nodlcheck" org-startup-with-deadline-check nil)))
520 l var val)
521 (while (setq l (assoc (pop opts) set))
522 (setq var (nth 1 l) val (nth 2 l))
523 (set (make-local-variable var) val))))
524 ((equal key "ARCHIVE")
525 (string-match " *$" value)
526 (setq arch (replace-match "" t t value))
527 (remove-text-properties 0 (length arch)
528 '(face t fontified t) arch)))
529 )))
530 (and cat (set (make-local-variable 'org-category) cat))
531 (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
532 (and arch (set (make-local-variable 'org-archive-location) arch))
533 (and int (set (make-local-variable 'org-todo-interpretation) int)))
534 ;; Compute the regular expressions and other local variables
535 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
536 org-todo-kwd-max-priority (1- (length org-todo-keywords))
537 org-ds-keyword-length (+ 2 (max (length org-deadline-string)
538 (length org-scheduled-string)))
539 org-done-string
540 (nth (1- (length org-todo-keywords)) org-todo-keywords)
541 org-todo-regexp
542 (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
543 "\\|") "\\)\\>")
544 org-not-done-regexp
545 (concat "\\<\\("
546 (mapconcat 'regexp-quote
547 (nreverse (cdr (reverse org-todo-keywords)))
548 "\\|")
549 "\\)\\>")
550 org-todo-line-regexp
551 (concat "^\\(\\*+\\)[ \t]*\\("
552 (mapconcat 'regexp-quote org-todo-keywords "\\|")
553 "\\)? *\\(.*\\)")
554 org-nl-done-regexp
555 (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
556 org-looking-at-done-regexp (concat "^" org-done-string "\\>")
557 org-deadline-regexp (concat "\\<" org-deadline-string)
558 org-deadline-time-regexp
559 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
560 org-deadline-line-regexp
561 (concat "\\<\\(" org-deadline-string "\\).*")
562 org-scheduled-regexp
563 (concat "\\<" org-scheduled-string)
564 org-scheduled-time-regexp
565 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>"))
566 (org-set-font-lock-defaults)))
567
568(defgroup org-time nil 488(defgroup org-time nil
569 "Options concerning time stamps and deadlines in Org-mode." 489 "Options concerning time stamps and deadlines in Org-mode."
570 :tag "Org Time" 490 :tag "Org Time"
@@ -1755,6 +1675,89 @@ When this is non-nil, the headline after the keyword is set to the
1755 )) 1675 ))
1756(defvar org-n-levels (length org-level-faces)) 1676(defvar org-n-levels (length org-level-faces))
1757 1677
1678(defun org-set-regexps-and-options ()
1679 "Precompute regular expressions for current buffer."
1680 (when (eq major-mode 'org-mode)
1681 (let ((re (org-make-options-regexp
1682 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
1683 "STARTUP" "ARCHIVE")))
1684 (splitre "[ \t]+")
1685 kwds int key value cat arch)
1686 (save-excursion
1687 (save-restriction
1688 (widen)
1689 (goto-char (point-min))
1690 (while (re-search-forward re nil t)
1691 (setq key (match-string 1) value (match-string 2))
1692 (cond
1693 ((equal key "CATEGORY")
1694 (if (string-match "[ \t]+$" value)
1695 (setq value (replace-match "" t t value)))
1696 (setq cat (intern value)))
1697 ((equal key "SEQ_TODO")
1698 (setq int 'sequence
1699 kwds (append kwds (org-split-string value splitre))))
1700 ((equal key "PRI_TODO")
1701 (setq int 'priority
1702 kwds (append kwds (org-split-string value splitre))))
1703 ((equal key "TYP_TODO")
1704 (setq int 'type
1705 kwds (append kwds (org-split-string value splitre))))
1706 ((equal key "STARTUP")
1707 (let ((opts (org-split-string value splitre))
1708 (set '(("fold" org-startup-folded t)
1709 ("nofold" org-startup-folded nil)
1710 ("content" org-startup-folded content)
1711 ("dlcheck" org-startup-with-deadline-check t)
1712 ("nodlcheck" org-startup-with-deadline-check nil)))
1713 l var val)
1714 (while (setq l (assoc (pop opts) set))
1715 (setq var (nth 1 l) val (nth 2 l))
1716 (set (make-local-variable var) val))))
1717 ((equal key "ARCHIVE")
1718 (string-match " *$" value)
1719 (setq arch (replace-match "" t t value))
1720 (remove-text-properties 0 (length arch)
1721 '(face t fontified t) arch)))
1722 )))
1723 (and cat (set (make-local-variable 'org-category) cat))
1724 (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
1725 (and arch (set (make-local-variable 'org-archive-location) arch))
1726 (and int (set (make-local-variable 'org-todo-interpretation) int)))
1727 ;; Compute the regular expressions and other local variables
1728 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
1729 org-todo-kwd-max-priority (1- (length org-todo-keywords))
1730 org-ds-keyword-length (+ 2 (max (length org-deadline-string)
1731 (length org-scheduled-string)))
1732 org-done-string
1733 (nth (1- (length org-todo-keywords)) org-todo-keywords)
1734 org-todo-regexp
1735 (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
1736 "\\|") "\\)\\>")
1737 org-not-done-regexp
1738 (concat "\\<\\("
1739 (mapconcat 'regexp-quote
1740 (nreverse (cdr (reverse org-todo-keywords)))
1741 "\\|")
1742 "\\)\\>")
1743 org-todo-line-regexp
1744 (concat "^\\(\\*+\\)[ \t]*\\("
1745 (mapconcat 'regexp-quote org-todo-keywords "\\|")
1746 "\\)? *\\(.*\\)")
1747 org-nl-done-regexp
1748 (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
1749 org-looking-at-done-regexp (concat "^" org-done-string "\\>")
1750 org-deadline-regexp (concat "\\<" org-deadline-string)
1751 org-deadline-time-regexp
1752 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
1753 org-deadline-line-regexp
1754 (concat "\\<\\(" org-deadline-string "\\).*")
1755 org-scheduled-regexp
1756 (concat "\\<" org-scheduled-string)
1757 org-scheduled-time-regexp
1758 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>"))
1759 (org-set-font-lock-defaults)))
1760
1758;; Tell the compiler about dynamically scoped variables, 1761;; Tell the compiler about dynamically scoped variables,
1759;; and variables from other packages 1762;; and variables from other packages
1760(eval-when-compile 1763(eval-when-compile
@@ -7869,7 +7872,7 @@ this variable requires a restart of Emacs to become effective."
7869table editor in arbitrary modes.") 7872table editor in arbitrary modes.")
7870(make-variable-buffer-local 'orgtbl-mode) 7873(make-variable-buffer-local 'orgtbl-mode)
7871 7874
7872(defvar orgtbl-mode-map (make-sparse-keymap) 7875(defvar orgtbl-mode-map (make-keymap)
7873 "Keymap for `orgtbl-mode'.") 7876 "Keymap for `orgtbl-mode'.")
7874 7877
7875;;;###autoload 7878;;;###autoload
@@ -8827,6 +8830,12 @@ headlines. The default is 3. Lower levels will become bulleted lists."
8827 (lang-words nil) 8830 (lang-words nil)
8828 (head-count 0) cnt 8831 (head-count 0) cnt
8829 (start 0) 8832 (start 0)
8833 ;; FIXME: The following returns always nil under XEmacs
8834 (coding-system (and (fboundp 'coding-system-get)
8835 (boundp 'buffer-file-coding-system)
8836 buffer-file-coding-system))
8837 (charset (and coding-system
8838 (coding-system-get coding-system 'mime-charset)))
8830 table-open type 8839 table-open type
8831 table-buffer table-orig-buffer 8840 table-buffer table-orig-buffer
8832 ) 8841 )
@@ -8855,13 +8864,14 @@ headlines. The default is 3. Lower levels will become bulleted lists."
8855 (insert (format 8864 (insert (format
8856 "<html lang=\"%s\"><head> 8865 "<html lang=\"%s\"><head>
8857<title>%s</title> 8866<title>%s</title>
8858<meta http-equiv=\"Content-Type\" content=\"text/html\"> 8867<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\">
8859<meta name=generator content=\"Org-mode\"> 8868<meta name=generator content=\"Org-mode\">
8860<meta name=generated content=\"%s %s\"> 8869<meta name=generated content=\"%s %s\">
8861<meta name=author content=\"%s\"> 8870<meta name=author content=\"%s\">
8862</head><body> 8871</head><body>
8863" 8872"
8864 language (org-html-expand title) date time author)) 8873 language (org-html-expand title) (or charset "iso-8859-1")
8874 date time author))
8865 (if title (insert (concat "<H1 align=\"center\">" 8875 (if title (insert (concat "<H1 align=\"center\">"
8866 (org-html-expand title) "</H1>\n"))) 8876 (org-html-expand title) "</H1>\n")))
8867 (if author (insert (concat (nth 1 lang-words) ": " author "\n"))) 8877 (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
@@ -9408,6 +9418,9 @@ When LEVEL is non-nil, increase section numbers on that level."
9408;; i k @ expendable from outline-mode 9418;; i k @ expendable from outline-mode
9409;; 0123456789 ! %^& ()_{} " `' free 9419;; 0123456789 ! %^& ()_{} " `' free
9410 9420
9421;; Make `C-c C-x' a prefix key
9422(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
9423
9411;; TAB key with modifiers 9424;; TAB key with modifiers
9412(define-key org-mode-map "\C-i" 'org-cycle) 9425(define-key org-mode-map "\C-i" 'org-cycle)
9413(define-key org-mode-map [(meta tab)] 'org-complete) 9426(define-key org-mode-map [(meta tab)] 'org-complete)
@@ -9587,7 +9600,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
9587 (if (fboundp 'command-remapping) 9600 (if (fboundp 'command-remapping)
9588 (define-key map (vector 'remap old) new) 9601 (define-key map (vector 'remap old) new)
9589 (substitute-key-definition old new map global-map))))) 9602 (substitute-key-definition old new map global-map)))))
9590 9603
9591(when (eq org-enable-table-editor 'optimized) 9604(when (eq org-enable-table-editor 'optimized)
9592 ;; If the user wants maximum table support, we need to hijack 9605 ;; If the user wants maximum table support, we need to hijack
9593 ;; some standard editing functions 9606 ;; some standard editing functions