annotate lisp/textmodes/remember.el @ 96269:603f00a9cc21

Comment typo.
author Glenn Morris <rgm@gnu.org>
date Wed, 25 Jun 2008 07:49:12 +0000
parents f4a69fedbd46
children 13379c367c35
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
1 ;;; remember --- a mode for quickly jotting down things to remember
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
2
87665
b9e8ab94c460 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 87626
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
b9e8ab94c460 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 87626
diff changeset
4 ;; 2008 Free Software Foundation, Inc.
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
5
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
6 ;; Author: John Wiegley <johnw@gnu.org>
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
7 ;; Created: 29 Mar 1999
94124
f22589cea1a1 Release Remember 2.0.
Michael Olson <mwolson@gnu.org>
parents: 93849
diff changeset
8 ;; Version: 2.0
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
9 ;; Keywords: data memory todo pim
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
10 ;; URL: http://gna.org/projects/remember-el/
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
11
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
13
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94428
diff changeset
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94428
diff changeset
16 ;; the Free Software Foundation, either version 3 of the License, or
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94428
diff changeset
17 ;; (at your option) any later version.
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
18
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
23
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
94670
f4a69fedbd46 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94428
diff changeset
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
26
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
28
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
29 ;; * The idea
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
30 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
31 ;; Todo lists, schedules, phone databases... everything we use
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
32 ;; databases for is really just a way to extend the power of our
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
33 ;; memory. To be able to remember what our conscious mind may not
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
34 ;; currently have access to.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
35 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
36 ;; There are many different databases out there -- and good ones --
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
37 ;; which this mode is not trying to replace. Rather, it's how that
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
38 ;; data gets there that's the question. Most of the time, we just
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
39 ;; want to say "Remember so-and-so's phone number, or that I have to
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
40 ;; buy dinner for the cats tonight." That's the FACT. How it's
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
41 ;; stored is really the computer's problem. But at this point in
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
42 ;; time, it's most definitely also the user's problem, and sometimes
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
43 ;; so laboriously so that people just let data slip, rather than
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
44 ;; expend the effort to record it.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
45 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
46 ;; "Remember" is a mode for remembering data. It uses whatever
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
47 ;; back-end is appropriate to record and correlate the data, but it's
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
48 ;; main intention is to allow you to express as _little_ structure as
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
49 ;; possible up front. If you later want to express more powerful
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
50 ;; relationships between your data, or state assumptions that were at
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
51 ;; first too implicit to be recognized, you can "study" the data later
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
52 ;; and rearrange it. But the initial "just remember this" impulse
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
53 ;; should be as close to simply throwing the data at Emacs as
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
54 ;; possible.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
55 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
56 ;; * Implementation
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
57 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
58 ;; Hyperbole, as a data presentation tool, always struck me as being
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
59 ;; very powerful, but it seemed to require a lot of "front-end" work
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
60 ;; before that data was really available. The problem with BBDB, or
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
61 ;; keeping up a Bibl-mode file, is that you have to use different
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
62 ;; functions to record the data, and it always takes time to stop what
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
63 ;; you're doing, format the data in the manner expected by that
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
64 ;; particular data interface, and then resume your work.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
65 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
66 ;; With "remember", you just hit `M-x remember' (you'd probably want
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
67 ;; to bind this to an easily accessible keystroke, like C-x M-r), slam
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
68 ;; in your text however you like, and then hit C-c C-c. It will file
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
69 ;; the data away for later retrieval, and possibly indexing.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
70 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
71 ;; Indexing is to data what "studying" is in the real world. What you
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
72 ;; do when you study (or lucubrate, for some of us) is to realize
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
73 ;; certain relationships implicit in the data, so that you can make
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
74 ;; use of those relationships. Expressing that a certain quote you
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
75 ;; remembered was a religious quote, and that you want the ability to
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
76 ;; pull up all quotes of a religious nature, is what studying does.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
77 ;; This is a more labor intensive task than the original remembering
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
78 ;; of the data, and it's typical in real life to set aside a special
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
79 ;; period of time for doing this work.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
80 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
81 ;; "Remember" works in the same way. When you enter data, either by
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
82 ;; typing it into a buffer, or using the contents of the selected
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
83 ;; region, it will store that data -- unindexed, uninterpreted -- in a
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
84 ;; data pool. It will also try to remember as much context
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
85 ;; information as possible (any text properties that were set, where
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
86 ;; you copied it from, when, how, etc). Later, you can walk through
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
87 ;; your accumulated set of data (both organized, and unorganized) and
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
88 ;; easily begin moving things around, and making annotations that will
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
89 ;; express the full meaning of that data, as far as you know it.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
90 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
91 ;; Obviously this latter stage is more user-interface intensive, and
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
92 ;; it would be nice if "remember" could do it as elegantly as
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
93 ;; possible, rather than requiring a billion keystrokes to reorganize
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
94 ;; your hierarchy. Well, as the future arrives, hopefully experience
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
95 ;; and user feedback will help to make this as intuitive a tool as
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
96 ;; possible.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
97 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
98 ;; * Future Goals
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
99 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
100 ;; This tool hopes to track (and by doing it with as little new code
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
101 ;; as possible):
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
102 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
103 ;; - The raw data that gets entered
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
104 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
105 ;; - The relationships between that data (either determined
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
106 ;; implicitly by parsing the input, or explicitly by the user's
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
107 ;; studying the data).
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
108 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
109 ;; - Revisioning of the data
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
110 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
111 ;; - Where it came from, and any context information that can be
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
112 ;; programmatically determined.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
113 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
114 ;; - Allowing particular views of the initially amorphous data pool
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
115 ;; (ala the Xanadu concept).
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
116 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
117 ;; - Storage of the data in a manner most appopriate to that data,
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
118 ;; such as keeping address-book type information in BBDB, etc.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
119 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
120 ;; * Using "remember"
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
121 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
122 ;; As a rough beginning, what I do is to keep my .notes file in
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
123 ;; outline-mode format, with a final entry called "* Raw data". Then,
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
124 ;; at intervals, I can move the data that gets appended there into
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
125 ;; other places. But certainly this should evolve into an intuitive
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
126 ;; mechanism for shuffling data off to its appropriate corner of the
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
127 ;; universe.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
128 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
129 ;; To map the primary remember function to the keystroke F8, do the
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
130 ;; following.
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
131 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
132 ;; (autoload 'remember "remember" nil t)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
133 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
134 ;; (define-key global-map [f8] 'remember)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
135 ;;
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
136 ;; * Feedback
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
137 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
138 ;; If Emacs could become a more intelligent data store, where
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
139 ;; brainstorming would focus on the IDEAS involved -- rather than the
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
140 ;; structuring and format of those ideas, or having to stop your
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
141 ;; current flow of work in order to record them -- it would map much
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
142 ;; more closely to how the mind (well, at least mine) works, and hence
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
143 ;; would eliminate that very manual-ness which computers from the very
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
144 ;; beginning have been championed as being able to reduce.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
145 ;;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
146 ;; Have you ever noticed that having a laptop to write on doesn't
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
147 ;; _actually_ increase the amount of quality material that you turn
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
148 ;; out, in the long run? Perhaps its because the time we save
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
149 ;; electronically in one way, we're losing electronically in another;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
150 ;; the tool should never dominate one's focus. As the mystic
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
151 ;; Faridu'd-Din `Attar wrote: "Be occupied as little as possible with
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
152 ;; things of the outer world but much with things of the inner world;
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
153 ;; then right action will overcome inaction."
87054
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
154 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
155 ;; * Diary integration
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
156 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
157 ;; To use, add the following to your .emacs:
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
158 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
159 ;; ;; This should be before other entries that may return t
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
160 ;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries)
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
161 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
162 ;; This module recognizes entries of the form
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
163 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
164 ;; DIARY: ....
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
165 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
166 ;; and puts them in your ~/.diary (or remember-diary-file) together
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
167 ;; with an annotation. Dates in the form YYYY.MM.DD are converted to
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
168 ;; YYYY-MM-DD so that diary can understand them.
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
169 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
170 ;; For example:
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
171 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
172 ;; DIARY: 2003.08.12 Sacha's birthday
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
173 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
174 ;; is stored as
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
175 ;;
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
176 ;; 2003.08.12 Sacha's birthday
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
177
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
178 ;;; History:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
179
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
180 ;;; Code:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
181
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
182 (provide 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
183
94124
f22589cea1a1 Release Remember 2.0.
Michael Olson <mwolson@gnu.org>
parents: 93849
diff changeset
184 (defconst remember-version "2.0"
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
185 "This version of remember.")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
186
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
187 (defgroup remember nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
188 "A mode to remember information."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
189 :group 'data)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
190
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
191 ;;; User Variables:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
192
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
193 (defcustom remember-mode-hook nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
194 "Functions run upon entering `remember-mode'."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
195 :type 'hook
85798
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
196 :options '(flyspell-mode turn-on-auto-fill org-remember-apply-template)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
197 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
198
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
199 (defcustom remember-in-new-frame nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
200 "Non-nil means use a separate frame for capturing remember data."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
201 :type 'boolean
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
202 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
203
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
204 (defcustom remember-register ?R
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
205 "The register in which the window configuration is stored."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
206 :type 'character
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
207 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
208
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
209 (defcustom remember-filter-functions nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
210 "*Functions run to filter remember data.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
211 All functions are run in the remember buffer."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
212 :type 'hook
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
213 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
214
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
215 (defcustom remember-handler-functions '(remember-append-to-file)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
216 "*Functions run to process remember data.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
217 Each function is called with the current buffer narrowed to what the
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
218 user wants remembered.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
219 If any function returns non-nil, the data is assumed to have been
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
220 recorded somewhere by that function. "
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
221 :type 'hook
85798
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
222 :options '(remember-store-in-mailbox
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
223 remember-append-to-file
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
224 remember-diary-extract-entries
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
225 org-remember-handler)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
226 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
227
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
228 (defcustom remember-all-handler-functions nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
229 "If non-nil every function in `remember-handler-functions' is
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
230 called."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
231 :type 'boolean
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
232 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
233
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
234 ;;; Internal Variables:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
235
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
236 (defvar remember-buffer "*Remember*"
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
237 "The name of the remember data entry buffer.")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
238
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
239 (defcustom remember-save-after-remembering t
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
240 "*Non-nil means automatically save after remembering."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
241 :type 'boolean
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
242 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
243
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
244 ;;; User Functions:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
245
85886
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
246 (defcustom remember-annotation-functions '(buffer-file-name)
b315ed3fcc4e Remove mentions of Planner in remember.el.
Michael Olson <mwolson@gnu.org>
parents: 85863
diff changeset
247 "Hook that returns an annotation to be inserted into the remember buffer."
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
248 :type 'hook
85798
5810ee84e0f9 remember.el: Add additional items to some defcustom options
Michael Olson <mwolson@gnu.org>
parents: 85772
diff changeset
249 :options '(org-remember-annotation buffer-file-name)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
250 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
251
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
252 (defvar remember-annotation nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
253 "Current annotation.")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
254 (defvar remember-initial-contents nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
255 "Initial contents to place into *Remember* buffer.")
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
256
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
257 (defcustom remember-before-remember-hook nil
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
258 "Functions run before switching to the *Remember* buffer."
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
259 :type 'hook
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
260 :group 'remember)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
261
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
262 (defcustom remember-run-all-annotation-functions-flag nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
263 "Non-nil means use all annotations returned by
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
264 `remember-annotation-functions'."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
265 :type 'boolean
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
266 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
267
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
268 ;;;###autoload
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
269 (defun remember (&optional initial)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
270 "Remember an arbitrary piece of data.
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
271 INITIAL is the text to initially place in the *Remember* buffer,
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
272 or nil to bring up a blank *Remember* buffer.
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
273
87626
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
274 With a prefix or a visible region, use the region as INITIAL."
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
275 (interactive
87626
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
276 (list (when (or current-prefix-arg
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
277 (and mark-active
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
278 transient-mark-mode))
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
279 (buffer-substring (region-beginning) (region-end)))))
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
280 (funcall (if remember-in-new-frame
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
281 #'frame-configuration-to-register
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
282 #'window-configuration-to-register) remember-register)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
283 (let* ((annotation
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
284 (if remember-run-all-annotation-functions-flag
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
285 (mapconcat 'identity
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
286 (delq nil
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
287 (mapcar 'funcall remember-annotation-functions))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
288 "\n")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
289 (run-hook-with-args-until-success
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
290 'remember-annotation-functions)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
291 (buf (get-buffer-create remember-buffer)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
292 (run-hooks 'remember-before-remember-hook)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
293 (funcall (if remember-in-new-frame
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
294 #'switch-to-buffer-other-frame
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
295 #'switch-to-buffer-other-window) buf)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
296 (if remember-in-new-frame
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
297 (set-window-dedicated-p
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
298 (get-buffer-window (current-buffer) (selected-frame)) t))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
299 (remember-mode)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
300 (when (= (point-max) (point-min))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
301 (when initial (insert initial))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
302 (setq remember-annotation annotation)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
303 (when remember-initial-contents (insert remember-initial-contents))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
304 (when (and (stringp annotation)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
305 (not (equal annotation "")))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
306 (insert "\n\n" annotation))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
307 (setq remember-initial-contents nil)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
308 (goto-char (point-min)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
309 (message "Use C-c C-c to remember the data.")))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
310
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
311 ;;;###autoload
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
312 (defun remember-other-frame (&optional initial)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
313 "Call `remember' in another frame."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
314 (interactive
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
315 (list (when current-prefix-arg
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
316 (buffer-substring (point) (mark)))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
317 (let ((remember-in-new-frame t))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
318 (remember initial)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
319
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
320 (defsubst remember-time-to-seconds (time)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
321 "Convert TIME to a floating point number."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
322 (+ (* (car time) 65536.0)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
323 (cadr time)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
324 (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
325
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
326 (defsubst remember-mail-date (&optional rfc822-p)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
327 "Return a simple date. Nothing fancy."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
328 (if rfc822-p
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
329 (format-time-string "%a, %e %b %Y %T %z" (current-time))
93171
d2b14ee5ca13 Remember: Write mbox in a way that works better with Mutt.
Michael Olson <mwolson@gnu.org>
parents: 87665
diff changeset
330 (format-time-string "%a %b %e %T %Y" (current-time))))
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
331
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
332 (defun remember-buffer-desc ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
333 "Using the first line of the current buffer, create a short description."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
334 (buffer-substring (point-min)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
335 (save-excursion
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
336 (goto-char (point-min))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
337 (end-of-line)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
338 (if (> (- (point) (point-min)) 60)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
339 (goto-char (+ (point-min) 60)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
340 (point))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
341
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
342 ;; Remembering to UNIX mailboxes
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
343
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
344 (defcustom remember-mailbox "~/Mail/remember"
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
345 "*The file in which to store remember data as mail."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
346 :type 'file
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
347 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
348
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
349 (defcustom remember-default-priority "medium"
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
350 "*The default priority for remembered mail messages."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
351 :type 'string
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
352 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
353
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
354 (defun remember-store-in-mailbox ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
355 "Store remember data as if it were incoming mail.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
356 In which case `remember-mailbox' should be the name of the mailbox.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
357 Each piece of psuedo-mail created will have an `X-Todo-Priority'
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
358 field, for the purpose of appropriate splitting."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
359 (let ((who (read-string "Who is this item related to? "))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
360 (moment
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
361 (format "%.0f" (remember-time-to-seconds (current-time))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
362 (desc (remember-buffer-desc))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
363 (text (buffer-string)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
364 (with-temp-buffer
93171
d2b14ee5ca13 Remember: Write mbox in a way that works better with Mutt.
Michael Olson <mwolson@gnu.org>
parents: 87665
diff changeset
365 (insert (format "From %s %s
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
366 Date: %s
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
367 From: %s
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
368 Message-Id: <remember-%s@%s>
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
369 X-Todo-Priority: %s
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
370 To: %s <%s>
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
371 Subject: %s\n\n"
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
372 (user-login-name)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
373 (remember-mail-date)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
374 (remember-mail-date t)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
375 who
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
376 moment (system-name)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
377 remember-default-priority
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
378 (user-full-name) user-mail-address
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
379 desc))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
380 (let ((here (point)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
381 (insert text)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
382 (unless (bolp)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
383 (insert "\n"))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
384 (insert "\n")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
385 (goto-char here)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
386 (while (re-search-forward "^\\(From[: ]\\)" nil t)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
387 (replace-match ">\\1")))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
388 (append-to-file (point-min) (point-max) remember-mailbox)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
389 t)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
390
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
391 ;; Remembering to plain files
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
392
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
393 (defcustom remember-data-file "~/.notes"
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
394 "*The file in which to store unprocessed data."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
395 :type 'file
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
396 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
397
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
398 (defcustom remember-leader-text "** "
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
399 "*The text used to begin each remember item."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
400 :type 'string
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
401 :group 'remember)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
402
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
403 (defun remember-append-to-file ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
404 "Remember, with description DESC, the given TEXT."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
405 (let ((text (buffer-string))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
406 (desc (remember-buffer-desc)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
407 (with-temp-buffer
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
408 (insert "\n" remember-leader-text (current-time-string)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
409 " (" desc ")\n\n" text)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
410 (if (not (bolp))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
411 (insert "\n"))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
412 (if (find-buffer-visiting remember-data-file)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
413 (let ((remember-text (buffer-string)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
414 (set-buffer (get-file-buffer remember-data-file))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
415 (save-excursion
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
416 (goto-char (point-max))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
417 (insert remember-text)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
418 (when remember-save-after-remembering (save-buffer))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
419 (append-to-file (point-min) (point-max) remember-data-file)))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
420
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
421 (defun remember-region (&optional beg end)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
422 "Remember the data from BEG to END.
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
423 It is called from within the *Remember* buffer to save the text
87626
a918e56d9947 Remember: If region is visible, use it as initial text.
Michael Olson <mwolson@gnu.org>
parents: 87054
diff changeset
424 that was entered.
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
425
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
426 If BEG and END are nil, the entire buffer will be remembered.
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
427
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
428 If you want to remember a region, supply a universal prefix to
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
429 `remember' instead. For example: C-u M-x remember RET."
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
430 ;; Sacha: I have no idea where remember.el gets this context information, but
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
431 ;; you can just use remember-annotation-functions.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
432 (interactive)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
433 (let ((b (or beg (min (point) (or (mark) (point-min)))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
434 (e (or end (max (point) (or (mark) (point-max))))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
435 (save-restriction
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
436 (narrow-to-region b e)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
437 (if remember-all-handler-functions
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
438 (run-hooks 'remember-handler-functions)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
439 (run-hook-with-args-until-success 'remember-handler-functions))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
440 (remember-destroy))))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
441
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
442 ;;;###autoload
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
443 (defun remember-clipboard ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
444 "Remember the contents of the current clipboard.
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
445 Most useful for remembering things from Netscape or other X Windows
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
446 application."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
447 (interactive)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
448 (remember (current-kill 0)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
449
85861
70f347d257ec Remember: Put on a low-cookie diet, and improve docstrings.
Michael Olson <mwolson@gnu.org>
parents: 85806
diff changeset
450 (defun remember-finalize ()
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
451 "Remember the contents of the current buffer."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
452 (interactive)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
453 (remember-region (point-min) (point-max)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
454
85889
683a6a9e56ab remember.el: Make remember-buffer an alias of remember-finalize
Michael Olson <mwolson@gnu.org>
parents: 85886
diff changeset
455 ;; Org needs this
85913
047b6a6087c2 Remember: Use define-obsolete-function-alias for `remember-buffer'.
Michael Olson <mwolson@gnu.org>
parents: 85889
diff changeset
456 (define-obsolete-function-alias 'remember-buffer 'remember-finalize)
85889
683a6a9e56ab remember.el: Make remember-buffer an alias of remember-finalize
Michael Olson <mwolson@gnu.org>
parents: 85886
diff changeset
457
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
458 (defun remember-destroy ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
459 "Destroy the current *Remember* buffer."
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
460 (interactive)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
461 (when (equal remember-buffer (buffer-name))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
462 (kill-buffer (current-buffer))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
463 (jump-to-register remember-register)))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
464
87054
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
465 ;;; Diary integration
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
466
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
467 (defcustom remember-diary-file nil
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
468 "*File for extracted diary entries.
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
469 If this is nil, then `diary-file' will be used instead."
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
470 :type 'file
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
471 :group 'remember)
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
472
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
473 (defun remember-diary-convert-entry (entry)
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
474 "Translate MSG to an entry readable by diary."
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
475 (save-match-data
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
476 (when remember-annotation
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
477 (setq entry (concat entry " " remember-annotation)))
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
478 (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" entry)
93847
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
479 (progn
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
480 ;; For calendar-date-style. This costs us nothing because
94428
f34f60c27b4f (diary-make-entry): Update the autoload.
Sam Steingold <sds@gnu.org>
parents: 94332
diff changeset
481 ;; the call to diary-make-entry below loads diary-lib
93847
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
482 ;; which requires calendar.
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
483 (require 'calendar)
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
484 (replace-match
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
485 (let ((style (if (boundp 'calendar-date-style)
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
486 calendar-date-style
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
487 ;; Don't complain about obsoleteness.
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
488 (if (with-no-warnings european-calendar-style)
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
489 'european
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
490 'american))))
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
491 (cond ((eq style 'european)
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
492 (concat (match-string 3 entry) "/"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
493 (match-string 2 entry) "/"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
494 (match-string 1 entry)))
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
495 ((eq style 'iso)
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
496 (concat (match-string 1 entry) "-"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
497 (match-string 2 entry) "-"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
498 (match-string 3 entry)))
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
499 (t (concat (match-string 2 entry) "/"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
500 (match-string 3 entry) "/"
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
501 (match-string 1 entry)))))
c3db88579de4 (remember-diary-convert-entry): Require calendar.
Glenn Morris <rgm@gnu.org>
parents: 93424
diff changeset
502 t t entry))
87054
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
503 entry)))
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
504
94428
f34f60c27b4f (diary-make-entry): Update the autoload.
Sam Steingold <sds@gnu.org>
parents: 94332
diff changeset
505 (autoload 'diary-make-entry "diary-lib")
87054
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
506
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
507 ;;;###autoload
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
508 (defun remember-diary-extract-entries ()
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
509 "Extract diary entries from the region."
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
510 (save-excursion
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
511 (goto-char (point-min))
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
512 (let (list)
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
513 (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t)
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
514 (add-to-list 'list (remember-diary-convert-entry (match-string 1))))
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
515 (when list
94332
4d11d8c52b60 (remember-diary-extract-entries): Use
Sam Steingold <sds@gnu.org>
parents: 94124
diff changeset
516 (diary-make-entry (mapconcat 'identity list "\n")
93849
067c4553fc2e (remember-diary-extract-entries): Don't pass diary-file, since it is
Glenn Morris <rgm@gnu.org>
parents: 93847
diff changeset
517 nil remember-diary-file))
87054
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
518 nil))) ;; Continue processing
25de6f4a58d8 Merge remember-diary.el into remember.el
Michael Olson <mwolson@gnu.org>
parents: 85913
diff changeset
519
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
520 ;;; Internal Functions:
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
521
85862
9e1be56af44a remember.el (remember-mode-map): Define and initialize in one step.
Michael Olson <mwolson@gnu.org>
parents: 85861
diff changeset
522 (defvar remember-mode-map
9e1be56af44a remember.el (remember-mode-map): Define and initialize in one step.
Michael Olson <mwolson@gnu.org>
parents: 85861
diff changeset
523 (let ((map (make-sparse-keymap)))
9e1be56af44a remember.el (remember-mode-map): Define and initialize in one step.
Michael Olson <mwolson@gnu.org>
parents: 85861
diff changeset
524 (define-key map "\C-x\C-s" 'remember-finalize)
9e1be56af44a remember.el (remember-mode-map): Define and initialize in one step.
Michael Olson <mwolson@gnu.org>
parents: 85861
diff changeset
525 (define-key map "\C-c\C-c" 'remember-finalize)
85863
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
526 (define-key map "\C-c\C-k" 'remember-destroy)
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
527
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
528 map)
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
529 "Keymap used in Remember mode.")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
530
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
531 (defun remember-mode ()
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
532 "Major mode for output from \\[remember].
85863
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
533 This buffer is used to collect data that you want to remember.
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
534
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
535 Just hit `C-c C-c' when you're done entering, and it will file
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
536 the data away for latter retrieval, and possible indexing.
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
537
f5b982bf98e0 Remember: Fix mistake in last commit and improve remember-mode docstring.
Michael Olson <mwolson@gnu.org>
parents: 85862
diff changeset
538 \\{remember-mode-map}"
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
539 (interactive)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
540 (kill-all-local-variables)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
541 (indented-text-mode)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
542 (use-local-map remember-mode-map)
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
543 (setq major-mode 'remember-mode
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
544 mode-name "Remember")
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
545 (run-hooks 'remember-mode-hook))
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
546
85806
2a9d361b3986 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 85798
diff changeset
547 ;; arch-tag: 59312a05-06c7-4da1-b6f7-5ea41c9d5577
85772
6b9c41aaadf8 Check in Remember Mode
Michael Olson <mwolson@gnu.org>
parents:
diff changeset
548 ;;; remember.el ends here