diff options
author | Miles Bader <miles@gnu.org> | 2007-11-11 00:56:44 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-11-11 00:56:44 +0000 |
commit | f23d76bdefbd4c06e14d69e99e50d35ce91c8226 (patch) | |
tree | ded28d1da6df2d0135514bac83074f4ca1c9099a /lisp/textmodes | |
parent | e2d092da5980a7d05a5428074f8eb4925fa801e8 (diff) | |
parent | a457417ee5ba797ab1c91d35ee957bb7a7f8d4b6 (diff) | |
download | emacs-f23d76bdefbd4c06e14d69e99e50d35ce91c8226.tar.gz |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-283
Diffstat (limited to 'lisp/textmodes')
-rw-r--r-- | lisp/textmodes/flyspell.el | 1 | ||||
-rw-r--r-- | lisp/textmodes/nroff-mode.el | 11 | ||||
-rw-r--r-- | lisp/textmodes/org-export-latex.el | 4 | ||||
-rw-r--r-- | lisp/textmodes/org-publish.el | 2 | ||||
-rw-r--r-- | lisp/textmodes/org.el | 5 | ||||
-rw-r--r-- | lisp/textmodes/reftex-index.el | 2 | ||||
-rw-r--r-- | lisp/textmodes/reftex.el | 344 | ||||
-rw-r--r-- | lisp/textmodes/remember-diary.el | 94 | ||||
-rw-r--r-- | lisp/textmodes/remember.el | 471 |
9 files changed, 753 insertions, 181 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 69d8c814f46..73e8ec49045 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -296,6 +296,7 @@ property of the major mode name.") ;;*--- mail mode -------------------------------------------------------*/ (put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) (put 'message-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify) +(defvar message-signature-separator) (defun mail-mode-flyspell-verify () "Function used for `flyspell-generic-check-word-predicate' in Mail mode." (let ((header-end (save-excursion diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el index 31ec234fddc..97b9f3b45c3 100644 --- a/lisp/textmodes/nroff-mode.el +++ b/lisp/textmodes/nroff-mode.el @@ -132,6 +132,8 @@ closing requests for requests that are used in matched pairs." (set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*") (set (make-local-variable 'comment-column) 24) (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent) + (set (make-local-variable 'comment-insert-comment-function) + 'nroff-insert-comment-function) (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression)) (defun nroff-outline-level () @@ -151,6 +153,7 @@ Puts a full-stop before comments on a line by themselves." (skip-chars-backward " \t") (if (bolp) (progn + ;; FIXME delete-horizontal-space? (setq pt (1+ pt)) (insert ?.) 1) @@ -163,6 +166,12 @@ Puts a full-stop before comments on a line by themselves." 9) 8)))))) ; add 9 to ensure at least two blanks (goto-char pt)))) +;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01869.html +(defun nroff-insert-comment-function () + "Function for `comment-insert-comment-function' in `nroff-mode'." + (indent-to (nroff-comment-indent)) + (insert comment-start)) + (defun nroff-count-text-lines (start end &optional print) "Count lines in region, except for nroff request lines. All lines not starting with a period are counted up. @@ -175,7 +184,7 @@ Noninteractively, return number of non-request lines from START to END." (save-restriction (narrow-to-region start end) (goto-char (point-min)) - (- (buffer-size) (forward-text-line (buffer-size))))))) + (- (buffer-size) (nroff-forward-text-line (buffer-size))))))) (defun nroff-forward-text-line (&optional cnt) "Go forward one nroff text line, skipping lines of nroff requests. diff --git a/lisp/textmodes/org-export-latex.el b/lisp/textmodes/org-export-latex.el index e6c68f25c4c..b1b31b622d1 100644 --- a/lisp/textmodes/org-export-latex.el +++ b/lisp/textmodes/org-export-latex.el @@ -1,6 +1,6 @@ ;;; org-export-latex.el --- LaTeX exporter for org-mode ;; -;; copyright (c) 2007 free software foundation, inc. +;; Copyright (C) 2007 Free Software Foundation, Inc. ;; ;; Emacs Lisp Archive Entry ;; Filename: org-export-latex.el @@ -22,7 +22,7 @@ ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ;; more details. -;; +;; ;; You should have received a copy of the GNU General Public License along ;; with GNU Emacs; see the file COPYING. If not, write to the Free Software ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA diff --git a/lisp/textmodes/org-publish.el b/lisp/textmodes/org-publish.el index 26dc409e19c..e98afaf4a6b 100644 --- a/lisp/textmodes/org-publish.el +++ b/lisp/textmodes/org-publish.el @@ -426,7 +426,7 @@ nil if not found." (defun org-publish-get-plist-from-filename (filename) "Return publishing configuration plist for file FILENAME." (let ((found nil)) - (mapcar + (mapc (lambda (plist) (let ((files (org-publish-get-base-files plist))) (if (member (expand-file-name filename) files) diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index 4ba90216d85..b555e6c1102 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 5.13g +;; Version: 5.13i ;; ;; This file is part of GNU Emacs. ;; @@ -83,7 +83,7 @@ ;;; Version -(defconst org-version "5.13g" +(defconst org-version "5.13i" "The version number of the file org.el.") (defun org-version () (interactive) @@ -9780,7 +9780,6 @@ With prefix arg ALL, do this for all lines in the table." (defun org-table-formula-substitute-names (f) "Replace $const with values in string F." - (message "form %s" f) (sit-for 1) (let ((start 0) a (f1 f) (pp (/= (string-to-char f) ?'))) ;; First, check for column names (while (setq start (string-match org-table-column-name-regexp f start)) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 35714ddb0b2..f430e9bd01a 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -52,7 +52,7 @@ which is part of AUCTeX, the string is first processed with the (interactive "P") (let* ((use-default (not (equal arg '(16)))) ; check for double prefix ;; check if we have an active selection - (active (if (boundp 'zmacs-regions) + (active (if (featurep 'xemacs) (and zmacs-regions (region-exists-p)) ; XEmacs (and transient-mark-mode mark-active))) ; Emacs (beg (if active diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 0c1beb17763..5383d88c386 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -338,6 +338,169 @@ (defvar reftex-toc-auto-recenter-timer nil "The idle timer used to recenter the toc window.") +;;; ========================================================================= +;;; +;;; Parser functions + +(autoload 'reftex-parse-one "reftex-parse" + "Re-parse this file." t) +(autoload 'reftex-parse-all "reftex-parse" + "Re-parse entire document." t) +(autoload 'reftex-do-parse "reftex-parse") +(autoload 'reftex-where-am-I "reftex-parse") +(autoload 'reftex-init-section-numbers "reftex-parse") +(autoload 'reftex-section-info "reftex-parse") +(autoload 'reftex-section-number "reftex-parse") +(autoload 'reftex-what-macro "reftex-parse") +(autoload 'reftex-what-macro-safe "reftex-parse") +(autoload 'reftex-index-info "reftex-parse") +(autoload 'reftex-index-info-safe "reftex-parse") +(autoload 'reftex-short-context "reftex-parse") +(autoload 'reftex-what-environment "reftex-parse") +(autoload 'reftex-what-special-env "reftex-parse") +(autoload 'reftex-move-over-touching-args "reftex-parse") +(autoload 'reftex-notice-new "reftex-parse") +(autoload 'reftex-nth-arg "reftex-parse") +(autoload 'reftex-locate-bibliography-files "reftex-parse") +(autoload 'reftex-ensure-index-support "reftex-parse") +(autoload 'reftex-everything-regexp "reftex-parse") + + +;;; ========================================================================= +;;; +;;; Labels and References + +(autoload 'reftex-label-location "reftex-ref") +(autoload 'reftex-label-info-update "reftex-ref") +(autoload 'reftex-label-info "reftex-ref") +(autoload 'reftex-label "reftex-ref" + "Insert a unique label." t) +(autoload 'reftex-reference "reftex-ref" + "Make a LaTeX reference." t) +(autoload 'reftex-varioref-vref "reftex-ref" + "Make a varioref reference." t) +(autoload 'reftex-fancyref-fref "reftex-ref" + "Make a fancyref \\fref reference." t) +(autoload 'reftex-fancyref-Fref "reftex-ref" + "Make a fancyref \\Fref reference." t) +(autoload 'reftex-show-label-location "reftex-ref") +(autoload 'reftex-query-label-type "reftex-ref") +(autoload 'reftex-goto-label "reftex-ref" + "Prompt for label name and go to that location." t) + +;;; ========================================================================= +;;; +;;; Table of contents + +(autoload 'reftex-toc "reftex-toc" + "Show the table of contents for the current document." t) +(autoload 'reftex-toc-recenter "reftex-toc" + "Display the TOC window and highlight line corresponding to current position." t) +(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" + "Toggle automatic recentering of TOC window." t) + +;;; ========================================================================= +;;; +;;; BibTeX citations. + +(autoload 'reftex-citep "reftex-cite") +(autoload 'reftex-citet "reftex-cite") +(autoload 'reftex-make-cite-echo-string "reftex-cite") +(autoload 'reftex-get-bibfile-list "reftex-cite") +(autoload 'reftex-pop-to-bibtex-entry "reftex-cite") +(autoload 'reftex-end-of-bib-entry "reftex-cite") +(autoload 'reftex-parse-bibtex-entry "reftex-cite") +(autoload 'reftex-citation "reftex-cite" + "Make a citation using BibTeX database files." t) +(autoload 'reftex-default-bibliography "reftex-cite") +(autoload 'reftex-bib-or-thebib "reftex-cite") +(autoload 'reftex-create-bibtex-file "reftex-cite") + +;;; ========================================================================= +;;; +;;; Selection + +(autoload 'reftex-select-label-mode "reftex-sel") +(autoload 'reftex-select-bib-mode "reftex-sel") +(autoload 'reftex-find-start-point "reftex-sel") +(autoload 'reftex-insert-docstruct "reftex-sel") +(autoload 'reftex-get-offset "reftex-sel") +(autoload 'reftex-select-item "reftex-sel") + + +;;; ========================================================================= +;;; +;;; Index support + +(autoload 'reftex-index "reftex-index" + "Query for an index macro and insert it along with its argments." t) +(autoload 'reftex-index-selection-or-word "reftex-index" + "Put selection or the word near point into the default index macro." t) +(autoload 'reftex-index-phrase-selection-or-word "reftex-index" + "Put selection or the word near point into Index Phrases File." t) +(autoload 'reftex-display-index "reftex-index" + "Display a buffer with an index compiled from the current document." t) +(autoload 'reftex-index-visit-phrases-buffer "reftex-index" + "Visit the Index Phrases File." t) +(autoload 'reftex-index-phrases-mode "reftex-index" + "Major mode for managing the Index phrases of a LaTeX document." t) +(autoload 'reftex-index-complete-tag "reftex-index") +(autoload 'reftex-index-complete-key "reftex-index") +(autoload 'reftex-index-show-entry "reftex-index") +(autoload 'reftex-index-select-tag "reftex-index") + + +;;; ========================================================================= +;;; +;;; View cross references + +(autoload 'reftex-view-crossref "reftex-dcr" + "View cross reference of \\ref or \\cite macro at point." t) +(autoload 'reftex-mouse-view-crossref "reftex-dcr" + "View cross reference of \\ref or \\cite macro where you click." t) +(autoload 'reftex-toggle-auto-view-crossref "reftex-dcr") +(autoload 'reftex-view-crossref-from-bibtex "reftex-dcr" + "View location in a LaTeX document which cites the BibTeX entry at point." t) + + +;;; ========================================================================= +;;; +;;; Operations on entire Multifile documents + +(autoload 'reftex-create-tags-file "reftex-global" + "Create TAGS file by running `etags' on the current document." t) +(autoload 'reftex-grep-document "reftex-global" + "Run grep query through all files related to this document." t) +(autoload 'reftex-search-document "reftex-global" + "Regexp search through all files of the current TeX document." t) +(autoload 'reftex-query-replace-document "reftex-global" + "Run a query-replace-regexp of FROM with TO over the entire TeX document." t) +(autoload 'reftex-find-duplicate-labels "reftex-global" + "Produce a list of all duplicate labels in the document." t) +(autoload 'reftex-change-label "reftex-global" + "Query replace FROM with TO in all \\label and \\ref commands." t) +(autoload 'reftex-renumber-simple-labels "reftex-global" + "Renumber all simple labels in the document to make them sequentially." t) +(autoload 'reftex-save-all-document-buffers "reftex-global" + "Save all documents associated with the current document." t) + + +;;; ========================================================================= +;;; +;;; AUCTeX Interface + +(autoload 'reftex-arg-label "reftex-auc") +(autoload 'reftex-arg-cite "reftex-auc") +(autoload 'reftex-arg-index-tag "reftex-auc") +(autoload 'reftex-arg-index "reftex-auc") +(autoload 'reftex-plug-into-AUCTeX "reftex-auc") +(autoload 'reftex-toggle-plug-into-AUCTeX "reftex-auc" + "Toggle Interface between AUCTeX and RefTeX on and off." t) +(autoload 'reftex-add-label-environments "reftex-auc") +(autoload 'reftex-add-to-label-alist "reftex-auc") +(autoload 'reftex-add-section-levels "reftex-auc") +(autoload 'reftex-notice-new-section "reftex-auc") + ;;;###autoload (defun turn-on-reftex () "Turn on RefTeX mode." @@ -1608,169 +1771,6 @@ When DIE is non-nil, throw an error if file not found." ;;; ========================================================================= ;;; -;;; Parser functions - -(autoload 'reftex-parse-one "reftex-parse" - "Re-parse this file." t) -(autoload 'reftex-parse-all "reftex-parse" - "Re-parse entire document." t) -(autoload 'reftex-do-parse "reftex-parse") -(autoload 'reftex-where-am-I "reftex-parse") -(autoload 'reftex-init-section-numbers "reftex-parse") -(autoload 'reftex-section-info "reftex-parse") -(autoload 'reftex-section-number "reftex-parse") -(autoload 'reftex-what-macro "reftex-parse") -(autoload 'reftex-what-macro-safe "reftex-parse") -(autoload 'reftex-index-info "reftex-parse") -(autoload 'reftex-index-info-safe "reftex-parse") -(autoload 'reftex-short-context "reftex-parse") -(autoload 'reftex-what-environment "reftex-parse") -(autoload 'reftex-what-special-env "reftex-parse") -(autoload 'reftex-move-over-touching-args "reftex-parse") -(autoload 'reftex-notice-new "reftex-parse") -(autoload 'reftex-nth-arg "reftex-parse") -(autoload 'reftex-locate-bibliography-files "reftex-parse") -(autoload 'reftex-ensure-index-support "reftex-parse") -(autoload 'reftex-everything-regexp "reftex-parse") - - -;;; ========================================================================= -;;; -;;; Labels and References - -(autoload 'reftex-label-location "reftex-ref") -(autoload 'reftex-label-info-update "reftex-ref") -(autoload 'reftex-label-info "reftex-ref") -(autoload 'reftex-label "reftex-ref" - "Insert a unique label." t) -(autoload 'reftex-reference "reftex-ref" - "Make a LaTeX reference." t) -(autoload 'reftex-varioref-vref "reftex-ref" - "Make a varioref reference." t) -(autoload 'reftex-fancyref-fref "reftex-ref" - "Make a fancyref \\fref reference." t) -(autoload 'reftex-fancyref-Fref "reftex-ref" - "Make a fancyref \\Fref reference." t) -(autoload 'reftex-show-label-location "reftex-ref") -(autoload 'reftex-query-label-type "reftex-ref") -(autoload 'reftex-goto-label "reftex-ref" - "Prompt for label name and go to that location." t) - -;;; ========================================================================= -;;; -;;; Table of contents - -(autoload 'reftex-toc "reftex-toc" - "Show the table of contents for the current document." t) -(autoload 'reftex-toc-recenter "reftex-toc" - "Display the TOC window and highlight line corresponding to current position." t) -(autoload 'reftex-toggle-auto-toc-recenter "reftex-toc" - "Toggle automatic recentering of TOC window." t) - -;;; ========================================================================= -;;; -;;; BibTeX citations. - -(autoload 'reftex-citep "reftex-cite") -(autoload 'reftex-citet "reftex-cite") -(autoload 'reftex-make-cite-echo-string "reftex-cite") -(autoload 'reftex-get-bibfile-list "reftex-cite") -(autoload 'reftex-pop-to-bibtex-entry "reftex-cite") -(autoload 'reftex-end-of-bib-entry "reftex-cite") -(autoload 'reftex-parse-bibtex-entry "reftex-cite") -(autoload 'reftex-citation "reftex-cite" - "Make a citation using BibTeX database files." t) -(autoload 'reftex-default-bibliography "reftex-cite") -(autoload 'reftex-bib-or-thebib "reftex-cite") -(autoload 'reftex-create-bibtex-file "reftex-cite") - -;;; ========================================================================= -;;; -;;; Selection - -(autoload 'reftex-select-label-mode "reftex-sel") -(autoload 'reftex-select-bib-mode "reftex-sel") -(autoload 'reftex-find-start-point "reftex-sel") -(autoload 'reftex-insert-docstruct "reftex-sel") -(autoload 'reftex-get-offset "reftex-sel") -(autoload 'reftex-select-item "reftex-sel") - - -;;; ========================================================================= -;;; -;;; Index support - -(autoload 'reftex-index "reftex-index" - "Query for an index macro and insert it along with its argments." t) -(autoload 'reftex-index-selection-or-word "reftex-index" - "Put selection or the word near point into the default index macro." t) -(autoload 'reftex-index-phrase-selection-or-word "reftex-index" - "Put selection or the word near point into Index Phrases File." t) -(autoload 'reftex-display-index "reftex-index" - "Display a buffer with an index compiled from the current document." t) -(autoload 'reftex-index-visit-phrases-buffer "reftex-index" - "Visit the Index Phrases File." t) -(autoload 'reftex-index-phrases-mode "reftex-index" - "Major mode for managing the Index phrases of a LaTeX document." t) -(autoload 'reftex-index-complete-tag "reftex-index") -(autoload 'reftex-index-complete-key "reftex-index") -(autoload 'reftex-index-show-entry "reftex-index") -(autoload 'reftex-index-select-tag "reftex-index") - - -;;; ========================================================================= -;;; -;;; View cross references - -(autoload 'reftex-view-crossref "reftex-dcr" - "View cross reference of \\ref or \\cite macro at point." t) -(autoload 'reftex-mouse-view-crossref "reftex-dcr" - "View cross reference of \\ref or \\cite macro where you click." t) -(autoload 'reftex-toggle-auto-view-crossref "reftex-dcr") -(autoload 'reftex-view-crossref-from-bibtex "reftex-dcr" - "View location in a LaTeX document which cites the BibTeX entry at point." t) - - -;;; ========================================================================= -;;; -;;; Operations on entire Multifile documents - -(autoload 'reftex-create-tags-file "reftex-global" - "Create TAGS file by running `etags' on the current document." t) -(autoload 'reftex-grep-document "reftex-global" - "Run grep query through all files related to this document." t) -(autoload 'reftex-search-document "reftex-global" - "Regexp search through all files of the current TeX document." t) -(autoload 'reftex-query-replace-document "reftex-global" - "Run a query-replace-regexp of FROM with TO over the entire TeX document." t) -(autoload 'reftex-find-duplicate-labels "reftex-global" - "Produce a list of all duplicate labels in the document." t) -(autoload 'reftex-change-label "reftex-global" - "Query replace FROM with TO in all \\label and \\ref commands." t) -(autoload 'reftex-renumber-simple-labels "reftex-global" - "Renumber all simple labels in the document to make them sequentially." t) -(autoload 'reftex-save-all-document-buffers "reftex-global" - "Save all documents associated with the current document." t) - - -;;; ========================================================================= -;;; -;;; AUCTeX Interface - -(autoload 'reftex-arg-label "reftex-auc") -(autoload 'reftex-arg-cite "reftex-auc") -(autoload 'reftex-arg-index-tag "reftex-auc") -(autoload 'reftex-arg-index "reftex-auc") -(autoload 'reftex-plug-into-AUCTeX "reftex-auc") -(autoload 'reftex-toggle-plug-into-AUCTeX "reftex-auc" - "Toggle Interface between AUCTeX and RefTeX on and off." t) -(autoload 'reftex-add-label-environments "reftex-auc") -(autoload 'reftex-add-to-label-alist "reftex-auc") -(autoload 'reftex-add-section-levels "reftex-auc") -(autoload 'reftex-notice-new-section "reftex-auc") - -;;; ========================================================================= -;;; ;;; Some generally useful functions (defun reftex-typekey-check (typekey conf-variable &optional n) @@ -2334,16 +2334,14 @@ IGNORE-WORDS List of words which should be removed from the string." (if (facep face) (throw 'exit face))))))) ;; Highlighting uses overlays. For XEmacs, we use extends. -(if (featurep 'xemacs) - (progn - (defalias 'reftex-make-overlay 'make-extent) - (defalias 'reftex-overlay-put 'set-extent-property) - (defalias 'reftex-move-overlay 'set-extent-endpoints) - (defalias 'reftex-delete-overlay 'detach-extent)) - (defalias 'reftex-make-overlay 'make-overlay) - (defalias 'reftex-overlay-put 'overlay-put) - (defalias 'reftex-move-overlay 'move-overlay) - (defalias 'reftex-delete-overlay 'delete-overlay)) +(defalias 'reftex-make-overlay + (if (featurep 'xemacs) 'make-extent 'make-overlay)) +(defalias 'reftex-overlay-put + (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) +(defalias 'reftex-move-overlay + (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)) +(defalias 'reftex-delete-overlay + (if (featurep 'xemacs) 'detach-extent 'delete-overlay)) ;; We keep a vector with several different overlays to do our highlighting. (defvar reftex-highlight-overlays [nil nil nil]) diff --git a/lisp/textmodes/remember-diary.el b/lisp/textmodes/remember-diary.el new file mode 100644 index 00000000000..e35909fb589 --- /dev/null +++ b/lisp/textmodes/remember-diary.el @@ -0,0 +1,94 @@ +;;; remember-diary --- extracting diary information from buffers + +;; Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc. + +;; Author: Sacha Chua <sacha@free.net.ph> +;; Created: 24 Mar 2004 +;; Keywords: data memory todo pim diary +;; URL: http://gna.org/projects/remember-el/ + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This module recognizes entries of the form +;; +;; DIARY: .... +;; +;; and puts them in your ~/.diary (or remember-diary-file) together +;; with an annotation. Planner-style dates (yyyy.mm.dd) are converted +;; to yyyy-mm-dd so that diary can understand them. +;; +;; For example: +;; +;; DIARY: 2003.08.12 Sacha's birthday +;; +;; is stored as +;; +;; 2003.08.12 Sacha's birthday [[/home/sacha/notebook/emacs/emacs-wiki/remember-diary.el]] +;; +;; To use, add the following to your .emacs: +;; +;; (require 'remember-diary) +;; ;; This should be before other entries that may return t +;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) +;; + +(require 'remember) +(require 'diary-lib) + +;;; Code: +(defcustom remember-diary-file diary-file + "*File for extracted diary entries." + :type 'file + :group 'remember) + +(defun remember-diary-convert-entry (entry) + "Translate MSG to an entry readable by diary." + (save-match-data + (when remember-annotation + (setq entry (concat entry " " remember-annotation))) + (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" entry) + (replace-match + (if european-calendar-style + (concat (match-string 3 entry) "/" + (match-string 2 entry) "/" + (match-string 1 entry)) + (concat (match-string 2 entry) "/" + (match-string 3 entry) "/" + (match-string 1 entry))) + t t entry) + entry))) + +;;;###autoload +(defun remember-diary-extract-entries () + "Extract diary entries from the region." + (save-excursion + (goto-char (point-min)) + (let (list) + (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t) + (add-to-list 'list (remember-diary-convert-entry (match-string 1)))) + (when list + (make-diary-entry (mapconcat 'identity list "\n") + nil remember-diary-file)) + nil))) ;; Continue processing + +(provide 'remember-diary) + +;; arch-tag: bda8a3f8-9a9b-46aa-8493-d71d7f1e445d +;;; remember-diary.el ends here diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el new file mode 100644 index 00000000000..7249f1d4c57 --- /dev/null +++ b/lisp/textmodes/remember.el @@ -0,0 +1,471 @@ +;;; remember --- a mode for quickly jotting down things to remember + +;; Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006, +;; 2007 Free Software Foundation, Inc. + +;; Author: John Wiegley <johnw@gnu.org> +;; Created: 29 Mar 1999 +;; Version: 1.9 +;; Keywords: data memory todo pim +;; URL: http://gna.org/projects/remember-el/ + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; * The idea +;; +;; Todo lists, schedules, phone databases... everything we use +;; databases for is really just a way to extend the power of our +;; memory. To be able to remember what our conscious mind may not +;; currently have access to. +;; +;; There are many different databases out there -- and good ones -- +;; which this mode is not trying to replace. Rather, it's how that +;; data gets there that's the question. Most of the time, we just +;; want to say "Remember so-and-so's phone number, or that I have to +;; buy dinner for the cats tonight." That's the FACT. How it's +;; stored is really the computer's problem. But at this point in +;; time, it's most definitely also the user's problem, and sometimes +;; so laboriously so that people just let data slip, rather than +;; expend the effort to record it. +;; +;; "Remember" is a mode for remembering data. It uses whatever +;; back-end is appropriate to record and correlate the data, but it's +;; main intention is to allow you to express as _little_ structure as +;; possible up front. If you later want to express more powerful +;; relationships between your data, or state assumptions that were at +;; first too implicit to be recognized, you can "study" the data later +;; and rearrange it. But the initial "just remember this" impulse +;; should be as close to simply throwing the data at Emacs as +;; possible. +;; +;; * Implementation +;; +;; Hyperbole, as a data presentation tool, always struck me as being +;; very powerful, but it seemed to require a lot of "front-end" work +;; before that data was really available. The problem with BBDB, or +;; keeping up a Bibl-mode file, is that you have to use different +;; functions to record the data, and it always takes time to stop what +;; you're doing, format the data in the manner expected by that +;; particular data interface, and then resume your work. +;; +;; With "remember", you just hit `M-x remember' (you'd probably want +;; to bind this to an easily accessible keystroke, like C-x M-r), slam +;; in your text however you like, and then hit C-c C-c. It will file +;; the data away for later retrieval, and possibly indexing. +;; +;; Indexing is to data what "studying" is in the real world. What you +;; do when you study (or lucubrate, for some of us) is to realize +;; certain relationships implicit in the data, so that you can make +;; use of those relationships. Expressing that a certain quote you +;; remembered was a religious quote, and that you want the ability to +;; pull up all quotes of a religious nature, is what studying does. +;; This is a more labor intensive task than the original remembering +;; of the data, and it's typical in real life to set aside a special +;; period of time for doing this work. +;; +;; "Remember" works in the same way. When you enter data, either by +;; typing it into a buffer, or using the contents of the selected +;; region, it will store that data -- unindexed, uninterpreted -- in a +;; data pool. It will also try to remember as much context +;; information as possible (any text properties that were set, where +;; you copied it from, when, how, etc). Later, you can walk through +;; your accumulated set of data (both organized, and unorganized) and +;; easily begin moving things around, and making annotations that will +;; express the full meaning of that data, as far as you know it. +;; +;; Obviously this latter stage is more user-interface intensive, and +;; it would be nice if "remember" could do it as elegantly as +;; possible, rather than requiring a billion keystrokes to reorganize +;; your hierarchy. Well, as the future arrives, hopefully experience +;; and user feedback will help to make this as intuitive a tool as +;; possible. +;; +;; * Future Goals +;; +;; This tool hopes to track (and by doing it with as little new code +;; as possible): +;; +;; - The raw data that gets entered +;; +;; - The relationships between that data (either determined +;; implicitly by parsing the input, or explicitly by the user's +;; studying the data). +;; +;; - Revisioning of the data +;; +;; - Where it came from, and any context information that can be +;; programmatically determined. +;; +;; - Allowing particular views of the initially amorphous data pool +;; (ala the Xanadu concept). +;; +;; - Storage of the data in a manner most appopriate to that data, +;; such as keeping address-book type information in BBDB, etc. +;; +;; * Using "remember" +;; +;; As a rough beginning, what I do is to keep my .notes file in +;; outline-mode format, with a final entry called "* Raw data". Then, +;; at intervals, I can move the data that gets appended there into +;; other places. But certainly this should evolve into an intuitive +;; mechanism for shuffling data off to its appropriate corner of the +;; universe. +;; +;; To map the primary remember function to the keystroke F8, do the +;; following. +;; +;; (autoload 'remember "remember" nil t) +;; +;; (define-key global-map [f8] 'remember) +;; +;; * Feedback +;; +;; If Emacs could become a more intelligent data store, where +;; brainstorming would focus on the IDEAS involved -- rather than the +;; structuring and format of those ideas, or having to stop your +;; current flow of work in order to record them -- it would map much +;; more closely to how the mind (well, at least mine) works, and hence +;; would eliminate that very manual-ness which computers from the very +;; beginning have been championed as being able to reduce. +;; +;; Have you ever noticed that having a laptop to write on doesn't +;; _actually_ increase the amount of quality material that you turn +;; out, in the long run? Perhaps its because the time we save +;; electronically in one way, we're losing electronically in another; +;; the tool should never dominate one's focus. As the mystic +;; Faridu'd-Din `Attar wrote: "Be occupied as little as possible with +;; things of the outer world but much with things of the inner world; +;; then right action will overcome inaction." + +;;; History: + +;;; Code: + +(provide 'remember) + +(defconst remember-version "1.9" + "This version of remember.") + +(defgroup remember nil + "A mode to remember information." + :group 'data) + +;;; User Variables: + +(defcustom remember-mode-hook nil + "Functions run upon entering `remember-mode'." + :type 'hook + :options '(flyspell-mode turn-on-auto-fill org-remember-apply-template) + :group 'remember) + +(defcustom remember-in-new-frame nil + "Non-nil means use a separate frame for capturing remember data." + :type 'boolean + :group 'remember) + +(defcustom remember-register ?R + "The register in which the window configuration is stored." + :type 'character + :group 'remember) + +(defcustom remember-filter-functions nil + "*Functions run to filter remember data. +All functions are run in the remember buffer." + :type 'hook + :group 'remember) + +(defcustom remember-handler-functions '(remember-append-to-file) + "*Functions run to process remember data. +Each function is called with the current buffer narrowed to what the +user wants remembered. +If any function returns non-nil, the data is assumed to have been +recorded somewhere by that function. " + :type 'hook + :options '(remember-store-in-mailbox + remember-append-to-file + remember-diary-extract-entries + org-remember-handler) + :group 'remember) + +(defcustom remember-all-handler-functions nil + "If non-nil every function in `remember-handler-functions' is +called." + :type 'boolean + :group 'remember) + +;;; Internal Variables: + +(defvar remember-buffer "*Remember*" + "The name of the remember data entry buffer.") + +(defcustom remember-save-after-remembering t + "*Non-nil means automatically save after remembering." + :type 'boolean + :group 'remember) + +;;; User Functions: + +(defcustom remember-annotation-functions '(buffer-file-name) + "Hook that returns an annotation to be inserted into the remember buffer." + :type 'hook + :options '(org-remember-annotation buffer-file-name) + :group 'remember) + +(defvar remember-annotation nil + "Current annotation.") +(defvar remember-initial-contents nil + "Initial contents to place into *Remember* buffer.") + +(defcustom remember-before-remember-hook nil + "Functions run before switching to the *Remember* buffer." + :type 'hook + :group 'remember) + +(defcustom remember-run-all-annotation-functions-flag nil + "Non-nil means use all annotations returned by +`remember-annotation-functions'." + :type 'boolean + :group 'remember) + +;;;###autoload +(defun remember (&optional initial) + "Remember an arbitrary piece of data. +INITIAL is the text to initially place in the *Remember* buffer, +or nil to bring up a blank *Remember* buffer. + +With a prefix, use the region as INITIAL." + (interactive + (list (when current-prefix-arg + (buffer-substring (point) (mark))))) + (funcall (if remember-in-new-frame + #'frame-configuration-to-register + #'window-configuration-to-register) remember-register) + (let* ((annotation + (if remember-run-all-annotation-functions-flag + (mapconcat 'identity + (delq nil + (mapcar 'funcall remember-annotation-functions)) + "\n") + (run-hook-with-args-until-success + 'remember-annotation-functions))) + (buf (get-buffer-create remember-buffer))) + (run-hooks 'remember-before-remember-hook) + (funcall (if remember-in-new-frame + #'switch-to-buffer-other-frame + #'switch-to-buffer-other-window) buf) + (if remember-in-new-frame + (set-window-dedicated-p + (get-buffer-window (current-buffer) (selected-frame)) t)) + (remember-mode) + (when (= (point-max) (point-min)) + (when initial (insert initial)) + (setq remember-annotation annotation) + (when remember-initial-contents (insert remember-initial-contents)) + (when (and (stringp annotation) + (not (equal annotation ""))) + (insert "\n\n" annotation)) + (setq remember-initial-contents nil) + (goto-char (point-min))) + (message "Use C-c C-c to remember the data."))) + +;;;###autoload +(defun remember-other-frame (&optional initial) + "Call `remember' in another frame." + (interactive + (list (when current-prefix-arg + (buffer-substring (point) (mark))))) + (let ((remember-in-new-frame t)) + (remember initial))) + +(defsubst remember-time-to-seconds (time) + "Convert TIME to a floating point number." + (+ (* (car time) 65536.0) + (cadr time) + (/ (or (car (cdr (cdr time))) 0) 1000000.0))) + +(defsubst remember-mail-date (&optional rfc822-p) + "Return a simple date. Nothing fancy." + (if rfc822-p + (format-time-string "%a, %e %b %Y %T %z" (current-time)) + (format-time-string "%c" (current-time)))) + +(defun remember-buffer-desc () + "Using the first line of the current buffer, create a short description." + (buffer-substring (point-min) + (save-excursion + (goto-char (point-min)) + (end-of-line) + (if (> (- (point) (point-min)) 60) + (goto-char (+ (point-min) 60))) + (point)))) + +;; Remembering to UNIX mailboxes + +(defcustom remember-mailbox "~/Mail/remember" + "*The file in which to store remember data as mail." + :type 'file + :group 'remember) + +(defcustom remember-default-priority "medium" + "*The default priority for remembered mail messages." + :type 'string + :group 'remember) + +(defun remember-store-in-mailbox () + "Store remember data as if it were incoming mail. +In which case `remember-mailbox' should be the name of the mailbox. +Each piece of psuedo-mail created will have an `X-Todo-Priority' +field, for the purpose of appropriate splitting." + (let ((who (read-string "Who is this item related to? ")) + (moment + (format "%.0f" (remember-time-to-seconds (current-time)))) + (desc (remember-buffer-desc)) + (text (buffer-string))) + (with-temp-buffer + (insert (format " +From %s %s +Date: %s +From: %s +Message-Id: <remember-%s@%s> +X-Todo-Priority: %s +To: %s <%s> +Subject: %s\n\n" + (user-login-name) + (remember-mail-date) + (remember-mail-date t) + who + moment (system-name) + remember-default-priority + (user-full-name) user-mail-address + desc)) + (let ((here (point))) + (insert text) + (unless (bolp) + (insert "\n")) + (insert "\n") + (goto-char here) + (while (re-search-forward "^\\(From[: ]\\)" nil t) + (replace-match ">\\1"))) + (append-to-file (point-min) (point-max) remember-mailbox) + t))) + +;; Remembering to plain files + +(defcustom remember-data-file "~/.notes" + "*The file in which to store unprocessed data." + :type 'file + :group 'remember) + +(defcustom remember-leader-text "** " + "*The text used to begin each remember item." + :type 'string + :group 'remember) + +(defun remember-append-to-file () + "Remember, with description DESC, the given TEXT." + (let ((text (buffer-string)) + (desc (remember-buffer-desc))) + (with-temp-buffer + (insert "\n" remember-leader-text (current-time-string) + " (" desc ")\n\n" text) + (if (not (bolp)) + (insert "\n")) + (if (find-buffer-visiting remember-data-file) + (let ((remember-text (buffer-string))) + (set-buffer (get-file-buffer remember-data-file)) + (save-excursion + (goto-char (point-max)) + (insert remember-text) + (when remember-save-after-remembering (save-buffer)))) + (append-to-file (point-min) (point-max) remember-data-file))))) + +(defun remember-region (&optional beg end) + "Remember the data from BEG to END. +It is called from within the *Remember* buffer to save the text +that was entered, + +If BEG and END are nil, the entire buffer will be remembered. + +If you want to remember a region, supply a universal prefix to +`remember' instead. For example: C-u M-x remember RET." + ;; Sacha: I have no idea where remember.el gets this context information, but + ;; you can just use remember-annotation-functions. + (interactive) + (let ((b (or beg (min (point) (or (mark) (point-min))))) + (e (or end (max (point) (or (mark) (point-max)))))) + (save-restriction + (narrow-to-region b e) + (if remember-all-handler-functions + (run-hooks 'remember-handler-functions) + (run-hook-with-args-until-success 'remember-handler-functions)) + (remember-destroy)))) + +;;;###autoload +(defun remember-clipboard () + "Remember the contents of the current clipboard. +Most useful for remembering things from Netscape or other X Windows +application." + (interactive) + (remember (current-kill 0))) + +(defun remember-finalize () + "Remember the contents of the current buffer." + (interactive) + (remember-region (point-min) (point-max))) + +;; Org needs this +(define-obsolete-function-alias 'remember-buffer 'remember-finalize) + +(defun remember-destroy () + "Destroy the current *Remember* buffer." + (interactive) + (when (equal remember-buffer (buffer-name)) + (kill-buffer (current-buffer)) + (jump-to-register remember-register))) + +;;; Internal Functions: + +(defvar remember-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-x\C-s" 'remember-finalize) + (define-key map "\C-c\C-c" 'remember-finalize) + (define-key map "\C-c\C-k" 'remember-destroy) + + map) + "Keymap used in Remember mode.") + +(defun remember-mode () + "Major mode for output from \\[remember]. +This buffer is used to collect data that you want to remember. + +Just hit `C-c C-c' when you're done entering, and it will file +the data away for latter retrieval, and possible indexing. + +\\{remember-mode-map}" + (interactive) + (kill-all-local-variables) + (indented-text-mode) + (use-local-map remember-mode-map) + (setq major-mode 'remember-mode + mode-name "Remember") + (run-hooks 'remember-mode-hook)) + +;; arch-tag: 59312a05-06c7-4da1-b6f7-5ea41c9d5577 +;;; remember.el ends here |