diff options
| author | Michael Olson | 2007-10-30 01:39:14 +0000 |
|---|---|---|
| committer | Michael Olson | 2007-10-30 01:39:14 +0000 |
| commit | 15f3eb73ae7ee6763c5d39bdeb6588050b9636f2 (patch) | |
| tree | 5c23dfc0421b4e7f048b73d21e1af09a4ebd6fce | |
| parent | f2168a4cda83e9e3489e3cb96e7764884c4029e1 (diff) | |
| download | emacs-15f3eb73ae7ee6763c5d39bdeb6588050b9636f2.tar.gz emacs-15f3eb73ae7ee6763c5d39bdeb6588050b9636f2.zip | |
Check in Remember Mode
| -rw-r--r-- | doc/misc/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/misc/remember.texi | 465 | ||||
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/textmodes/remember-diary.el | 93 | ||||
| -rw-r--r-- | lisp/textmodes/remember.el | 472 |
7 files changed, 1049 insertions, 0 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index fcb1f0ac651..1c6edbf22dc 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2007-10-30 Michael Olson <mwolson@gnu.org> | ||
| 2 | |||
| 3 | * remember.texi: New file containing the Remember Mode Manual. | ||
| 4 | |||
| 1 | 2007-10-29 Michael Albinus <michael.albinus@gmx.de> | 5 | 2007-10-29 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * tramp.texi (Connection caching): Host names must be different | 7 | * tramp.texi (Connection caching): Host names must be different |
diff --git a/doc/misc/remember.texi b/doc/misc/remember.texi new file mode 100644 index 00000000000..39f8b1e0d49 --- /dev/null +++ b/doc/misc/remember.texi | |||
| @@ -0,0 +1,465 @@ | |||
| 1 | \input texinfo @c -*-texinfo-*- | ||
| 2 | @c %**start of header | ||
| 3 | @setfilename ../../info/remember | ||
| 4 | @settitle Remember Manual | ||
| 5 | @c %**end of header | ||
| 6 | |||
| 7 | @dircategory Emacs | ||
| 8 | @direntry | ||
| 9 | * Remember: (remember). Simple information manager for Emacs | ||
| 10 | @end direntry | ||
| 11 | |||
| 12 | @syncodeindex fn cp | ||
| 13 | |||
| 14 | @copying | ||
| 15 | This manual is for Remember Mode, version 1.9 | ||
| 16 | |||
| 17 | Copyright @copyright{} 2001, 2004, 2005, 2007 Free Software Foundation, Inc. | ||
| 18 | |||
| 19 | @quotation | ||
| 20 | Permission is granted to copy, distribute and/or modify this document | ||
| 21 | under the terms of the GNU Free Documentation License, Version 1.2 | ||
| 22 | or any later version published by the Free Software Foundation; | ||
| 23 | with no Invariant Sections, no Front-Cover Texts, and no Back-Cover | ||
| 24 | Texts. A copy of the license is included in the section entitled ``GNU | ||
| 25 | Free Documentation License''. | ||
| 26 | @end quotation | ||
| 27 | @end copying | ||
| 28 | |||
| 29 | @titlepage | ||
| 30 | @title Guide to Remember Mode | ||
| 31 | @subtitle a simple information manager | ||
| 32 | @subtitle for Emacs and XEmacs | ||
| 33 | |||
| 34 | @c The following two commands | ||
| 35 | @c start the copyright page. | ||
| 36 | @page | ||
| 37 | @vskip 0pt plus 1filll | ||
| 38 | @insertcopying | ||
| 39 | @end titlepage | ||
| 40 | |||
| 41 | @c So the toc is printed at the start | ||
| 42 | @contents | ||
| 43 | |||
| 44 | @ifnottex | ||
| 45 | @node Top, Preface, (dir), (dir) | ||
| 46 | @comment node-name, next, previous, up | ||
| 47 | @top Remember | ||
| 48 | |||
| 49 | @insertcopying | ||
| 50 | @end ifnottex | ||
| 51 | |||
| 52 | @menu | ||
| 53 | * Preface:: About the documentation. | ||
| 54 | * Introduction:: What is Remember Mode? | ||
| 55 | * Installation:: How to install Remember. | ||
| 56 | * Implementation:: How Remember came into existence. | ||
| 57 | * Quick Start:: Get started using Remember. | ||
| 58 | * Backends:: Backends for saving notes. | ||
| 59 | * Function Reference:: Interactive functions in remember.el. | ||
| 60 | * Copying:: The GNU General Public License gives you | ||
| 61 | permission to redistribute Remember on | ||
| 62 | certain terms; it also explains that | ||
| 63 | there is no warranty. | ||
| 64 | * GNU Free Documentation License:: The license for this documentation. | ||
| 65 | * Concept Index:: Search for terms. | ||
| 66 | |||
| 67 | @detailmenu | ||
| 68 | --- The Detailed Node Listing --- | ||
| 69 | |||
| 70 | Backends | ||
| 71 | |||
| 72 | * Text File:: Saving to a text file. | ||
| 73 | * Mailbox:: Saving to a mailbox. | ||
| 74 | * Bibliography:: Saving to a bibliography. | ||
| 75 | * Planner Page:: Saving to a Planner page. | ||
| 76 | |||
| 77 | @end detailmenu | ||
| 78 | @end menu | ||
| 79 | |||
| 80 | @node Preface, Introduction, Top, Top | ||
| 81 | @comment node-name, next, previous, up | ||
| 82 | @chapter Preface | ||
| 83 | |||
| 84 | This document describes remember-el, which was written by John Wiegley, | ||
| 85 | was once maintained by Sacha Chua, and is now maintained by the Emacs | ||
| 86 | developers. | ||
| 87 | |||
| 88 | This document is a work in progress, and your contribution will be | ||
| 89 | greatly appreciated. | ||
| 90 | |||
| 91 | @node Introduction, Installation, Preface, Top | ||
| 92 | @comment node-name, next, previous, up | ||
| 93 | @chapter Introduction | ||
| 94 | |||
| 95 | Todo lists, schedules, phone databases... everything we use databases | ||
| 96 | for is really just a way to extend the power of our memory, to be able | ||
| 97 | to remember what our conscious mind may not currently have access to. | ||
| 98 | |||
| 99 | There are many different databases out there---and good ones--- | ||
| 100 | which this mode is not trying to replace. Rather, it's how that | ||
| 101 | data gets there that's the question. Most of the time, we just | ||
| 102 | want to say "Remember so-and-so's phone number, or that I have to | ||
| 103 | buy dinner for the cats tonight." That's the FACT. How it's | ||
| 104 | stored is really the computer's problem. But at this point in | ||
| 105 | time, it's most definitely also the user's problem, and sometimes | ||
| 106 | so laboriously so that people just let data slip, rather than | ||
| 107 | expend the effort to record it. | ||
| 108 | |||
| 109 | ``Remember'' is a mode for remembering data. It uses whatever | ||
| 110 | back-end is appropriate to record and correlate the data, but its main | ||
| 111 | intention is to allow you to express as @emph{little} structure as | ||
| 112 | possible up front. If you later want to express more powerful | ||
| 113 | relationships between your data, or state assumptions that were at | ||
| 114 | first too implicit to be recognized, you can ``study'' the data later | ||
| 115 | and rearrange it. But the initial ``just remember this'' impulse | ||
| 116 | should be as close to simply throwing the data at Emacs as possible. | ||
| 117 | |||
| 118 | Have you ever noticed that having a laptop to write on doesn't | ||
| 119 | @emph{actually} increase the amount of quality material that you turn | ||
| 120 | out, in the long run? Perhaps it's because the time we save | ||
| 121 | electronically in one way, we're losing electronically in another; the | ||
| 122 | tool should never dominate one's focus. As the mystic Faridu'd-Din | ||
| 123 | `Attar wrote: ``Be occupied as little as possible with things of the | ||
| 124 | outer world but much with things of the inner world; then right action | ||
| 125 | will overcome inaction.'' | ||
| 126 | |||
| 127 | If Emacs could become a more intelligent data store, where brainstorming | ||
| 128 | would focus on the @emph{ideas} involved---rather than the structuring | ||
| 129 | and format of those ideas, or having to stop your current flow of work | ||
| 130 | in order to record them---it would map much more closely to how the mind | ||
| 131 | (well, at least mine) works, and hence would eliminate that very | ||
| 132 | manual-ness which computers from the very beginning have been championed | ||
| 133 | as being able to reduce. | ||
| 134 | |||
| 135 | @node Installation, Implementation, Introduction, Top | ||
| 136 | @comment node-name, next, previous, up | ||
| 137 | @chapter Installation | ||
| 138 | |||
| 139 | Installing Remember Mode is as simple as adding the following lines to | ||
| 140 | your Emacs configuration file (usually @file{~/.emacs.d/init.el} or | ||
| 141 | @file{~/.emacs}). | ||
| 142 | |||
| 143 | @lisp | ||
| 144 | (add-to-list 'load-path "/path/to/remember") | ||
| 145 | (require 'remember) | ||
| 146 | @end lisp | ||
| 147 | |||
| 148 | @node Implementation, Quick Start, Installation, Top | ||
| 149 | @comment node-name, next, previous, up | ||
| 150 | @chapter Implementation | ||
| 151 | |||
| 152 | Hyperbole, as a data presentation tool, always struck me as being very | ||
| 153 | powerful, but it seemed to require a lot of ``front-end'' work before | ||
| 154 | that data was really available. The problem with BBDB, or keeping up | ||
| 155 | a Bibl-mode file, is that you have to use different functions to | ||
| 156 | record the data, and it always takes time to stop what you're doing, | ||
| 157 | format the data in the manner expected by that particular data | ||
| 158 | interface, and then resume your work. | ||
| 159 | |||
| 160 | With ``remember'', you just hit @kbd{M-x remember} (you'd probably | ||
| 161 | want to bind this to an easily accessible keystroke, like @kbd{C-x | ||
| 162 | M-r}), slam in your text however you like, and then hit @kbd{C-c C-c}. | ||
| 163 | It will file the data away for later retrieval, and possibly indexing. | ||
| 164 | |||
| 165 | Indexing is to data what ``studying'' is in the real world. What you | ||
| 166 | do when you study (or lucubrate, for some of us) is to realize certain | ||
| 167 | relationships implicit in the data, so that you can make use of those | ||
| 168 | relationships. Expressing that a certain quote you remembered was a | ||
| 169 | religious quote, and that you want the ability to pull up all quotes | ||
| 170 | of a religious nature, is what studying does. This is a more labor | ||
| 171 | intensive task than the original remembering of the data, and it's | ||
| 172 | typical in real life to set aside a special period of time for doing | ||
| 173 | this work. | ||
| 174 | |||
| 175 | ``Remember'' works in the same way. When you enter data, either by | ||
| 176 | typing it into a buffer, or using the contents of the selected region, | ||
| 177 | it will store that data---unindexed, uninterpreted---in a data pool. | ||
| 178 | It will also try to remember as much context information as possible | ||
| 179 | (any text properties that were set, where you copied it from, when, | ||
| 180 | how, etc). Later, you can walk through your accumulated set of data | ||
| 181 | (both organized, and unorganized) and easily begin moving things | ||
| 182 | around, and making annotations that will express the full meaning of | ||
| 183 | that data, as far as you know it. | ||
| 184 | |||
| 185 | Obviously this latter stage is more user-interface intensive, and it | ||
| 186 | would be nice if ``remember'' could do it as elegantly as possible, | ||
| 187 | rather than requiring a billion keystrokes to reorganize your | ||
| 188 | hierarchy. Well, as the future arrives, hopefully experience and user | ||
| 189 | feedback will help to make this as intuitive a tool as possible. | ||
| 190 | |||
| 191 | @node Quick Start, Backends, Implementation, Top | ||
| 192 | @comment node-name, next, previous, up | ||
| 193 | @chapter Quick Start | ||
| 194 | |||
| 195 | @itemize | ||
| 196 | |||
| 197 | @item | ||
| 198 | Load @file{remember.el}. | ||
| 199 | |||
| 200 | @item | ||
| 201 | Type @kbd{M-x remember}. The @samp{*Remember*} buffer should be | ||
| 202 | displayed. | ||
| 203 | |||
| 204 | @item | ||
| 205 | Type in what you want to remember. The first line will be treated as | ||
| 206 | the headline, and the rest of the buffer will contain the body of the | ||
| 207 | note. | ||
| 208 | |||
| 209 | @item | ||
| 210 | Type @kbd{C-c C-c} (@code{remember-buffer}) to save the note and close | ||
| 211 | the @samp{*Remember*} buffer. | ||
| 212 | @end itemize | ||
| 213 | |||
| 214 | By default, @code{remember-buffer} saves the note in @file{~/.notes}. | ||
| 215 | You can edit it now to see the remembered and timestamped note. You | ||
| 216 | can edit this file however you want. New entries will always be added | ||
| 217 | to the end. | ||
| 218 | |||
| 219 | To remember a region of text, use the universal prefix. @kbd{C-u M-x | ||
| 220 | remember} displays a @samp{*Remember*} buffer with the region as the | ||
| 221 | initial contents. | ||
| 222 | |||
| 223 | As a simple beginning, you can start by using the Text File backend, | ||
| 224 | keeping your @file{~/.notes} file in outline-mode format, with a final | ||
| 225 | entry called @samp{* Raw data}. Remembered data will be added to the | ||
| 226 | end of the file. Every so often, you can move the data that gets | ||
| 227 | appended there into other files, or reorganize your document. | ||
| 228 | |||
| 229 | You can also store remembered data in other backends. | ||
| 230 | (@pxref{Backends}) | ||
| 231 | |||
| 232 | Here is one way to map the remember functions in your @file{.emacs} to | ||
| 233 | very accessible keystrokes facilities using the mode: | ||
| 234 | |||
| 235 | @lisp | ||
| 236 | (autoload 'remember ``remember'' nil t) | ||
| 237 | (autoload 'remember-region ``remember'' nil t) | ||
| 238 | |||
| 239 | (define-key global-map (kbd "<f9> r") 'remember) | ||
| 240 | (define-key global-map (kbd "<f9> R") 'remember-region) | ||
| 241 | @end lisp | ||
| 242 | |||
| 243 | Check out the Planner package | ||
| 244 | (@uref{http://www.emacswiki.org/cgi-bin/wiki/PlannerMode}) for plenty | ||
| 245 | of annotation functions you can use with Remember. If you use Planner, | ||
| 246 | you can easily publish your remembered notes as HTML and RSS. | ||
| 247 | (@pxref{Planner Page}) | ||
| 248 | |||
| 249 | By default, remember uses the first annotation returned by | ||
| 250 | @code{remember-annotation-functions}. To include all of the annotations, | ||
| 251 | set @code{remember-run-all-annotation-functions-flag} to non-nil. | ||
| 252 | |||
| 253 | @defopt remember-run-all-annotation-functions-flag | ||
| 254 | Non-nil means use all annotations returned by | ||
| 255 | @code{remember-annotation-functions}. | ||
| 256 | @end defopt | ||
| 257 | |||
| 258 | You can write custom functions that use a different set of | ||
| 259 | remember-annotation-functions. For example: | ||
| 260 | |||
| 261 | @lisp | ||
| 262 | (defun my/remember-with-filename () | ||
| 263 | "Always use the filename." | ||
| 264 | (interactive) | ||
| 265 | (let ((remember-annotation-functions '(buffer-file-name))) | ||
| 266 | (call-interactively 'remember))) | ||
| 267 | @end lisp | ||
| 268 | |||
| 269 | @node Backends, Function Reference, Quick Start, Top | ||
| 270 | @chapter Backends | ||
| 271 | |||
| 272 | You can save remembered notes to a variety of backends. | ||
| 273 | |||
| 274 | @menu | ||
| 275 | * Text File:: Saving to a text file. | ||
| 276 | * Mailbox:: Saving to a mailbox. | ||
| 277 | * Bibliography:: Saving to a bibliography. | ||
| 278 | * Planner Page:: Saving to a Planner page. | ||
| 279 | @end menu | ||
| 280 | |||
| 281 | @node Text File, Mailbox, Backends, Backends | ||
| 282 | @section Saving to a Text File | ||
| 283 | @cindex text file | ||
| 284 | @cindex outline | ||
| 285 | |||
| 286 | This backend comes with Emacs. | ||
| 287 | |||
| 288 | @lisp | ||
| 289 | (setq remember-handler-functions '(remember-append-to-file)) | ||
| 290 | @end lisp | ||
| 291 | |||
| 292 | @defopt remember-data-file | ||
| 293 | @end defopt | ||
| 294 | |||
| 295 | @defopt remember-leader-text | ||
| 296 | @end defopt | ||
| 297 | |||
| 298 | @node Mailbox, Bibliography, Text File, Backends | ||
| 299 | @section Saving to a Mailbox | ||
| 300 | @cindex mailbox, saving to a | ||
| 301 | |||
| 302 | @lisp | ||
| 303 | (setq remember-handler-functions '(remember-store-in-mailbox)) | ||
| 304 | @end lisp | ||
| 305 | |||
| 306 | @defopt remember-mailbox | ||
| 307 | Name of mailbox to save messages to. | ||
| 308 | @end defopt | ||
| 309 | |||
| 310 | This backend does not come with Emacs. To get it, download the latest | ||
| 311 | version of Remember from @url{http://download.gna.org/remember-el/}. | ||
| 312 | |||
| 313 | If you want to use BBDB to associate remembered snippets with entries | ||
| 314 | in your contact database, use the following code snippet: | ||
| 315 | |||
| 316 | @lisp | ||
| 317 | (require 'remember-bbdb) | ||
| 318 | (setq remember-handler-functions '(remember-bbdb-store-in-mailbox)) | ||
| 319 | @end lisp | ||
| 320 | |||
| 321 | @node Bibliography, Planner Page, Mailbox, Backends | ||
| 322 | @section Saving to a Bibliography | ||
| 323 | |||
| 324 | This backend does not come with Emacs. To get it, download the latest | ||
| 325 | version of Remember from @url{http://download.gna.org/remember-el/}. | ||
| 326 | |||
| 327 | Bibl-mode is a major mode for maintaining bibliography files. You can | ||
| 328 | get bibl-mode from: | ||
| 329 | @uref{http://ftp.azc.uam.mx/mirrors/gnu/emacs-lisp/bosullivan-packages/bibl-mode/}. | ||
| 330 | |||
| 331 | @lisp | ||
| 332 | (require 'remember-bibl) | ||
| 333 | @end lisp | ||
| 334 | |||
| 335 | @defun remember-url | ||
| 336 | Remember a URL in @code{bibl-mode} that is being visited with w3. | ||
| 337 | @end defun | ||
| 338 | |||
| 339 | @defun remember-location | ||
| 340 | Remember a bookmark location in `bibl-mode'. | ||
| 341 | @end defun | ||
| 342 | |||
| 343 | You can use this in addition to your normal remember backend. | ||
| 344 | |||
| 345 | @node Planner Page, , Bibliography, Backends | ||
| 346 | @comment node-name, next, previous, up | ||
| 347 | @section Saving to a Planner Page | ||
| 348 | @cindex @file{remember-planner.el}, using | ||
| 349 | @cindex remember-el, using with PlannerMode | ||
| 350 | |||
| 351 | This backend does not come with Emacs. To get it, download the latest | ||
| 352 | version of Remember from @url{http://download.gna.org/remember-el/}. | ||
| 353 | |||
| 354 | If you are using PlannerMode, depending on your configuration, notes | ||
| 355 | made using remember-el may actually be saved to a project and/or day | ||
| 356 | plan page. | ||
| 357 | |||
| 358 | @file{remember-planner.el} makes the notes you save with remember have | ||
| 359 | more context information associated with them, in the way that | ||
| 360 | PlannerMode tasks do. | ||
| 361 | |||
| 362 | To use remember-planner, place this in your @file{.emacs}: | ||
| 363 | |||
| 364 | @lisp | ||
| 365 | (require 'remember-planner) | ||
| 366 | (setq remember-handler-functions '(remember-planner-append)) | ||
| 367 | @end lisp | ||
| 368 | |||
| 369 | To take advantage of PlannerMode's annotation functions, add the | ||
| 370 | following code as well: | ||
| 371 | |||
| 372 | @lisp | ||
| 373 | (setq remember-annotation-functions planner-annotation-functions) | ||
| 374 | @end lisp | ||
| 375 | |||
| 376 | Then, type @kbd{M-x remember} to remember new text, @kbd{M-x | ||
| 377 | remember-region} to remember the current region, or @kbd{C-u M-x | ||
| 378 | remember} to remember the current region but have an opportunity to | ||
| 379 | edit it before it is saved. | ||
| 380 | |||
| 381 | @defopt remember-planner-xref-p | ||
| 382 | Non-nil means cross-reference new entries with plan pages. Plan pages | ||
| 383 | are useful for gathering related information. If you don't want a note | ||
| 384 | associated with a plan page, you can press RET to accept the default | ||
| 385 | (just today's page) or specify nil at the prompt. | ||
| 386 | @end defopt | ||
| 387 | |||
| 388 | @defopt remember-planner-copy-on-xref-flag | ||
| 389 | Non-nil means copy note text instead of moving it to the plan page. If | ||
| 390 | nil, move the note body to the plan page, leaving a cross-reference | ||
| 391 | link on the day page. This results in shorter day pages but may be | ||
| 392 | harder for people to read. | ||
| 393 | @end defopt | ||
| 394 | |||
| 395 | @defopt remember-planner-timestamp-format | ||
| 396 | Format of timestamp for remember entries. | ||
| 397 | @end defopt | ||
| 398 | |||
| 399 | @file{remember-planner.el} does not define any interactive functions | ||
| 400 | or keybindings. | ||
| 401 | |||
| 402 | @node Function Reference, Copying, Backends, Top | ||
| 403 | @comment node-name, next, previous, up | ||
| 404 | @chapter Function Reference | ||
| 405 | |||
| 406 | @subheading Interactive functions | ||
| 407 | |||
| 408 | @file{remember.el} defines the following interactive functions: | ||
| 409 | |||
| 410 | @defun remember initial | ||
| 411 | Remember an arbitrary piece of data. With a prefix, it will use the | ||
| 412 | region as @var{initial}. | ||
| 413 | @end defun | ||
| 414 | |||
| 415 | @defun remember-region beg end | ||
| 416 | If called from within the remember buffer, @var{beg} and @var{end} are | ||
| 417 | ignored, and the entire buffer will be remembered. If called from any | ||
| 418 | other buffer, that region, plus any context information specific to | ||
| 419 | that region, will be remembered. | ||
| 420 | @end defun | ||
| 421 | |||
| 422 | @defun remember-clipboard | ||
| 423 | Remember the contents of the current clipboard. This is most useful | ||
| 424 | for remembering things from Netscape or other X Windows applications. | ||
| 425 | @end defun | ||
| 426 | |||
| 427 | @defun remember-buffer | ||
| 428 | Remember the contents of the current buffer. | ||
| 429 | @end defun | ||
| 430 | |||
| 431 | @defun remember-mode | ||
| 432 | This enters the major mode for output from @command{remember}. This | ||
| 433 | buffer is used to collect data that you want remember. Just hit | ||
| 434 | @kbd{C-c C-c} when you're done entering, and it will go ahead and file | ||
| 435 | the data for latter retrieval, and possible indexing. | ||
| 436 | @end defun | ||
| 437 | |||
| 438 | @subheading Keystrokes | ||
| 439 | |||
| 440 | @file{remember.el} defines the following keybindings by default: | ||
| 441 | |||
| 442 | @table @kbd | ||
| 443 | |||
| 444 | @item C-x C-s (`remember-buffer') | ||
| 445 | |||
| 446 | @item C-c C-c (`remember-buffer') | ||
| 447 | |||
| 448 | @end table | ||
| 449 | |||
| 450 | @node Copying, GNU Free Documentation License, Function Reference, Top | ||
| 451 | @comment node-name, next, previous, up | ||
| 452 | @appendix GNU GENERAL PUBLIC LICENSE | ||
| 453 | @include gpl.texi | ||
| 454 | |||
| 455 | @node GNU Free Documentation License, Concept Index, Copying, Top | ||
| 456 | @appendix GNU Free Documentation License | ||
| 457 | @include doclicense.texi | ||
| 458 | |||
| 459 | @node Concept Index, , GNU Free Documentation License, Top | ||
| 460 | @comment node-name, next, previous, up | ||
| 461 | @unnumbered Index | ||
| 462 | |||
| 463 | @printindex cp | ||
| 464 | |||
| 465 | @bye | ||
diff --git a/etc/ChangeLog b/etc/ChangeLog index d552455e101..017db136df7 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2007-10-30 Michael Olson <mwolson@gnu.org> | ||
| 2 | |||
| 3 | * NEWS: Add entry for Remember Mode. | ||
| 4 | |||
| 1 | 2007-10-29 Glenn Morris <rgm@gnu.org> | 5 | 2007-10-29 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * refcards/gnus-refcard.tex: Restore Feb 2007 copyright | 7 | * refcards/gnus-refcard.tex: Restore Feb 2007 copyright |
| @@ -163,6 +163,11 @@ its usage. | |||
| 163 | 163 | ||
| 164 | ** minibuffer-indicate-depth-mode shows the minibuffer depth in the prompt. | 164 | ** minibuffer-indicate-depth-mode shows the minibuffer depth in the prompt. |
| 165 | 165 | ||
| 166 | ** Remember Mode (remember.el) is now included with Emacs. It is a | ||
| 167 | mode for quickly jotting down things to remember. Included with | ||
| 168 | remember.el is a backend that can save notes to a Diary file. Please | ||
| 169 | consult the Remember Manual for usage details. | ||
| 170 | |||
| 166 | 171 | ||
| 167 | * Changes in Specialized Modes and Packages in Emacs 23.1 | 172 | * Changes in Specialized Modes and Packages in Emacs 23.1 |
| 168 | 173 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 79cffa6e39a..07bc2244f7a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -2,6 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | * desktop.el (desktop-minor-mode-table): Add line for ERC. | 3 | * desktop.el (desktop-minor-mode-table): Add line for ERC. |
| 4 | 4 | ||
| 5 | * textmodes/remember.el: New file that implements a mode for | ||
| 6 | quickly jotting down things to remember. | ||
| 7 | |||
| 8 | * textmodes/remember-diary.el: A backend for remember.el that | ||
| 9 | implements saving notes to a Diary file. | ||
| 10 | |||
| 5 | 2007-10-29 Ken Manheimer <ken.manheimer@gmail.com> | 11 | 2007-10-29 Ken Manheimer <ken.manheimer@gmail.com> |
| 6 | 12 | ||
| 7 | * allout.el (allout-command-prefix, allout-inhibit-auto-fill): | 13 | * allout.el (allout-command-prefix, allout-inhibit-auto-fill): |
diff --git a/lisp/textmodes/remember-diary.el b/lisp/textmodes/remember-diary.el new file mode 100644 index 00000000000..4053908e1fc --- /dev/null +++ b/lisp/textmodes/remember-diary.el | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | ;;; remember-diary --- extracting diary information from buffers | ||
| 2 | |||
| 3 | ;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Sacha Chua <sacha@free.net.ph> | ||
| 6 | ;; Created: 24 Mar 2004 | ||
| 7 | ;; Keywords: data memory todo pim diary | ||
| 8 | ;; URL: http://gna.org/projects/remember-el/ | ||
| 9 | |||
| 10 | ;; This file is part of GNU Emacs. | ||
| 11 | |||
| 12 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 13 | ;; it under the terms of the GNU General Public License as published by | ||
| 14 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
| 15 | ;; any later version. | ||
| 16 | |||
| 17 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | ;; GNU General Public License for more details. | ||
| 21 | |||
| 22 | ;; You should have received a copy of the GNU General Public License | ||
| 23 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 24 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 25 | ;; Boston, MA 02110-1301, USA. | ||
| 26 | |||
| 27 | ;;; Commentary: | ||
| 28 | |||
| 29 | ;; This module recognizes entries of the form | ||
| 30 | ;; | ||
| 31 | ;; DIARY: .... | ||
| 32 | ;; | ||
| 33 | ;; and puts them in your ~/.diary (or remember-diary-file) together | ||
| 34 | ;; with an annotation. Planner-style dates (yyyy.mm.dd) are converted | ||
| 35 | ;; to yyyy-mm-dd so that diary can understand them. | ||
| 36 | ;; | ||
| 37 | ;; For example: | ||
| 38 | ;; | ||
| 39 | ;; DIARY: 2003.08.12 Sacha's birthday | ||
| 40 | ;; | ||
| 41 | ;; is stored as | ||
| 42 | ;; | ||
| 43 | ;; 2003.08.12 Sacha's birthday [[/home/sacha/notebook/emacs/emacs-wiki/remember-diary.el]] | ||
| 44 | ;; | ||
| 45 | ;; To use, add the following to your .emacs: | ||
| 46 | ;; | ||
| 47 | ;; (require 'remember-diary) | ||
| 48 | ;; ;; This should be before other entries that may return t | ||
| 49 | ;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) | ||
| 50 | ;; | ||
| 51 | |||
| 52 | (require 'remember) | ||
| 53 | (require 'diary-lib) | ||
| 54 | |||
| 55 | ;;; Code: | ||
| 56 | (defcustom remember-diary-file diary-file | ||
| 57 | "*File for extracted diary entries." | ||
| 58 | :type 'file | ||
| 59 | :group 'remember) | ||
| 60 | |||
| 61 | (defun remember-diary-convert-entry (entry) | ||
| 62 | "Translate MSG to an entry readable by diary." | ||
| 63 | (save-match-data | ||
| 64 | (when remember-annotation | ||
| 65 | (setq entry (concat entry " " remember-annotation))) | ||
| 66 | (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" entry) | ||
| 67 | (replace-match | ||
| 68 | (if european-calendar-style | ||
| 69 | (concat (match-string 3 entry) "/" | ||
| 70 | (match-string 2 entry) "/" | ||
| 71 | (match-string 1 entry)) | ||
| 72 | (concat (match-string 2 entry) "/" | ||
| 73 | (match-string 3 entry) "/" | ||
| 74 | (match-string 1 entry))) | ||
| 75 | t t entry) | ||
| 76 | entry))) | ||
| 77 | |||
| 78 | ;;;###autoload | ||
| 79 | (defun remember-diary-extract-entries () | ||
| 80 | "Extract diary entries from the region." | ||
| 81 | (save-excursion | ||
| 82 | (goto-char (point-min)) | ||
| 83 | (let (list) | ||
| 84 | (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t) | ||
| 85 | (add-to-list 'list (remember-diary-convert-entry (match-string 1)))) | ||
| 86 | (when list | ||
| 87 | (make-diary-entry (mapconcat 'identity list "\n") | ||
| 88 | nil remember-diary-file)) | ||
| 89 | nil))) ;; Continue processing | ||
| 90 | |||
| 91 | (provide 'remember-diary) | ||
| 92 | |||
| 93 | ;;; remember-diary.el ends here | ||
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el new file mode 100644 index 00000000000..ac9931ff320 --- /dev/null +++ b/lisp/textmodes/remember.el | |||
| @@ -0,0 +1,472 @@ | |||
| 1 | ;;; remember --- a mode for quickly jotting down things to remember | ||
| 2 | |||
| 3 | ;; Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006, | ||
| 4 | ;; 2007 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: John Wiegley <johnw@gnu.org> | ||
| 7 | ;; Created: 29 Mar 1999 | ||
| 8 | ;; Version: 1.9 | ||
| 9 | ;; Keywords: data memory todo pim | ||
| 10 | ;; URL: http://gna.org/projects/remember-el/ | ||
| 11 | |||
| 12 | ;; This file is part of GNU Emacs. | ||
| 13 | |||
| 14 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 15 | ;; it under the terms of the GNU General Public License as published by | ||
| 16 | ;; the Free Software Foundation; either version 3, or (at your option) | ||
| 17 | ;; any later version. | ||
| 18 | |||
| 19 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 20 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 22 | ;; GNU General Public License for more details. | ||
| 23 | |||
| 24 | ;; You should have received a copy of the GNU General Public License | ||
| 25 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 26 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 27 | ;; Boston, MA 02110-1301, USA. | ||
| 28 | |||
| 29 | ;;; Commentary: | ||
| 30 | |||
| 31 | ;; The idea | ||
| 32 | ;; | ||
| 33 | ;; Todo lists, schedules, phone databases... everything we use | ||
| 34 | ;; databases for is really just a way to extend the power of our | ||
| 35 | ;; memory. To be able to remember what our conscious mind may not | ||
| 36 | ;; currently have access to. | ||
| 37 | ;; | ||
| 38 | ;; There are many different databases out there -- and good ones -- | ||
| 39 | ;; which this mode is not trying to replace. Rather, it's how that | ||
| 40 | ;; data gets there that's the question. Most of the time, we just | ||
| 41 | ;; want to say "Remember so-and-so's phone number, or that I have to | ||
| 42 | ;; buy dinner for the cats tonight." That's the FACT. How it's | ||
| 43 | ;; stored is really the computer's problem. But at this point in | ||
| 44 | ;; time, it's most definitely also the user's problem, and sometimes | ||
| 45 | ;; so laboriously so that people just let data slip, rather than | ||
| 46 | ;; expend the effort to record it. | ||
| 47 | ;; | ||
| 48 | ;; "Remember" is a mode for remembering data. It uses whatever | ||
| 49 | ;; back-end is appropriate to record and correlate the data, but it's | ||
| 50 | ;; main intention is to allow you to express as _little_ structure as | ||
| 51 | ;; possible up front. If you later want to express more powerful | ||
| 52 | ;; relationships between your data, or state assumptions that were at | ||
| 53 | ;; first too implicit to be recognized, you can "study" the data later | ||
| 54 | ;; and rearrange it. But the initial "just remember this" impulse | ||
| 55 | ;; should be as close to simply throwing the data at Emacs as | ||
| 56 | ;; possible. | ||
| 57 | ;; | ||
| 58 | ;; Implementation | ||
| 59 | ;; | ||
| 60 | ;; Hyperbole, as a data presentation tool, always struck me as being | ||
| 61 | ;; very powerful, but it seemed to require a lot of "front-end" work | ||
| 62 | ;; before that data was really available. The problem with BBDB, or | ||
| 63 | ;; keeping up a Bibl-mode file, is that you have to use different | ||
| 64 | ;; functions to record the data, and it always takes time to stop what | ||
| 65 | ;; you're doing, format the data in the manner expected by that | ||
| 66 | ;; particular data interface, and then resume your work. | ||
| 67 | ;; | ||
| 68 | ;; With "remember", you just hit `M-x remember' (you'd probably want | ||
| 69 | ;; to bind this to an easily accessible keystroke, like C-x M-r), slam | ||
| 70 | ;; in your text however you like, and then hit C-c C-c. It will file | ||
| 71 | ;; the data away for later retrieval, and possibly indexing. | ||
| 72 | ;; | ||
| 73 | ;; Indexing is to data what "studying" is in the real world. What you | ||
| 74 | ;; do when you study (or lucubrate, for some of us) is to realize | ||
| 75 | ;; certain relationships implicit in the data, so that you can make | ||
| 76 | ;; use of those relationships. Expressing that a certain quote you | ||
| 77 | ;; remembered was a religious quote, and that you want the ability to | ||
| 78 | ;; pull up all quotes of a religious nature, is what studying does. | ||
| 79 | ;; This is a more labor intensive task than the original remembering | ||
| 80 | ;; of the data, and it's typical in real life to set aside a special | ||
| 81 | ;; period of time for doing this work. | ||
| 82 | ;; | ||
| 83 | ;; "Remember" works in the same way. When you enter data, either by | ||
| 84 | ;; typing it into a buffer, or using the contents of the selected | ||
| 85 | ;; region, it will store that data -- unindexed, uninterpreted -- in a | ||
| 86 | ;; data pool. It will also try to remember as much context | ||
| 87 | ;; information as possible (any text properties that were set, where | ||
| 88 | ;; you copied it from, when, how, etc). Later, you can walk through | ||
| 89 | ;; your accumulated set of data (both organized, and unorganized) and | ||
| 90 | ;; easily begin moving things around, and making annotations that will | ||
| 91 | ;; express the full meaning of that data, as far as you know it. | ||
| 92 | ;; | ||
| 93 | ;; Obviously this latter stage is more user-interface intensive, and | ||
| 94 | ;; it would be nice if "remember" could do it as elegantly as | ||
| 95 | ;; possible, rather than requiring a billion keystrokes to reorganize | ||
| 96 | ;; your hierarchy. Well, as the future arrives, hopefully experience | ||
| 97 | ;; and user feedback will help to make this as intuitive a tool as | ||
| 98 | ;; possible. | ||
| 99 | ;; | ||
| 100 | ;; Future Goals | ||
| 101 | ;; | ||
| 102 | ;; This tool hopes to track (and by doing it with as little new code | ||
| 103 | ;; as possible): | ||
| 104 | ;; | ||
| 105 | ;; - The raw data that gets entered | ||
| 106 | ;; | ||
| 107 | ;; - The relationships between that data (either determined | ||
| 108 | ;; implicitly by parsing the input, or explicitly by the user's | ||
| 109 | ;; studying the data). | ||
| 110 | ;; | ||
| 111 | ;; - Revisioning of the data | ||
| 112 | ;; | ||
| 113 | ;; - Where it came from, and any context information that can be | ||
| 114 | ;; programmatically determined. | ||
| 115 | ;; | ||
| 116 | ;; - Allowing particular views of the initially amorphous data pool | ||
| 117 | ;; (ala the Xanadu concept). | ||
| 118 | ;; | ||
| 119 | ;; - Storage of the data in a manner most appopriate to that data, | ||
| 120 | ;; such as keeping address-book type information in BBDB, etc. | ||
| 121 | ;; | ||
| 122 | ;; Using "remember" | ||
| 123 | ;; | ||
| 124 | ;; As a rough beginning, what I do is to keep my .notes file in | ||
| 125 | ;; outline-mode format, with a final entry called "* Raw data". Then, | ||
| 126 | ;; at intervals, I can move the data that gets appended there into | ||
| 127 | ;; other places. But certainly this should evolve into an intuitive | ||
| 128 | ;; mechanism for shuffling data off to its appropriate corner of the | ||
| 129 | ;; universe. | ||
| 130 | ;; | ||
| 131 | ;; Mapping the remember functions to very accessible keystrokes | ||
| 132 | ;; facilities using the mode: | ||
| 133 | ;; | ||
| 134 | ;; (autoload 'remember "remember" nil t) | ||
| 135 | ;; (autoload 'remember-region "remember" nil t) | ||
| 136 | ;; | ||
| 137 | ;; (define-key global-map [f8] 'remember) | ||
| 138 | ;; (define-key global-map [f9] 'remember-region) | ||
| 139 | ;; | ||
| 140 | ;; planner.el users should use `remember-to-planner' instead of `remember' | ||
| 141 | ;; to save more context information. | ||
| 142 | ;; | ||
| 143 | ;; Feedback | ||
| 144 | ;; | ||
| 145 | ;; If Emacs could become a more intelligent data store, where | ||
| 146 | ;; brainstorming would focus on the IDEAS involved -- rather than the | ||
| 147 | ;; structuring and format of those ideas, or having to stop your | ||
| 148 | ;; current flow of work in order to record them -- it would map much | ||
| 149 | ;; more closely to how the mind (well, at least mine) works, and hence | ||
| 150 | ;; would eliminate that very manual-ness which computers from the very | ||
| 151 | ;; beginning have been championed as being able to reduce. | ||
| 152 | ;; | ||
| 153 | ;; Have you ever noticed that having a laptop to write on doesn't | ||
| 154 | ;; _actually_ increase the amount of quality material that you turn | ||
| 155 | ;; out, in the long run? Perhaps its because the time we save | ||
| 156 | ;; electronically in one way, we're losing electronically in another; | ||
| 157 | ;; the tool should never dominate one's focus. As the mystic | ||
| 158 | ;; Faridu'd-Din `Attar wrote: "Be occupied as little as possible with | ||
| 159 | ;; things of the outer world but much with things of the inner world; | ||
| 160 | ;; then right action will overcome inaction." | ||
| 161 | |||
| 162 | ;;; History: | ||
| 163 | |||
| 164 | ;;; Code: | ||
| 165 | |||
| 166 | (provide 'remember) | ||
| 167 | |||
| 168 | (defconst remember-version "1.9" | ||
| 169 | "This version of remember.") | ||
| 170 | |||
| 171 | (defgroup remember nil | ||
| 172 | "A mode to remember information." | ||
| 173 | :group 'data) | ||
| 174 | |||
| 175 | ;;; User Variables: | ||
| 176 | |||
| 177 | (defcustom remember-mode-hook nil | ||
| 178 | "Functions run upon entering `remember-mode'." | ||
| 179 | :type 'hook | ||
| 180 | :options '(flyspell-mode turn-on-auto-fill) | ||
| 181 | :group 'remember) | ||
| 182 | |||
| 183 | (defcustom remember-in-new-frame nil | ||
| 184 | "Non-nil means use a separate frame for capturing remember data." | ||
| 185 | :type 'boolean | ||
| 186 | :group 'remember) | ||
| 187 | |||
| 188 | (defcustom remember-register ?R | ||
| 189 | "The register in which the window configuration is stored." | ||
| 190 | :type 'character | ||
| 191 | :group 'remember) | ||
| 192 | |||
| 193 | (defcustom remember-filter-functions nil | ||
| 194 | "*Functions run to filter remember data. | ||
| 195 | All functions are run in the remember buffer." | ||
| 196 | :type 'hook | ||
| 197 | :group 'remember) | ||
| 198 | |||
| 199 | (defcustom remember-handler-functions '(remember-append-to-file) | ||
| 200 | "*Functions run to process remember data. | ||
| 201 | Each function is called with the current buffer narrowed to what the | ||
| 202 | user wants remembered. | ||
| 203 | If any function returns non-nil, the data is assumed to have been | ||
| 204 | recorded somewhere by that function. " | ||
| 205 | :type 'hook | ||
| 206 | :group 'remember) | ||
| 207 | |||
| 208 | (defcustom remember-all-handler-functions nil | ||
| 209 | "If non-nil every function in `remember-handler-functions' is | ||
| 210 | called." | ||
| 211 | :type 'boolean | ||
| 212 | :group 'remember) | ||
| 213 | |||
| 214 | ;;; Internal Variables: | ||
| 215 | |||
| 216 | (defvar remember-buffer "*Remember*" | ||
| 217 | "The name of the remember data entry buffer.") | ||
| 218 | |||
| 219 | (defcustom remember-save-after-remembering t | ||
| 220 | "*Non-nil means automatically save after remembering." | ||
| 221 | :type 'boolean | ||
| 222 | :group 'remember) | ||
| 223 | |||
| 224 | ;;; User Functions: | ||
| 225 | |||
| 226 | ;; People with planner.el can set this to planner-annotation-functions: | ||
| 227 | ;; (defvaralias 'remember-annotation-functions 'planner-annotation-functions) | ||
| 228 | ;; or (defalias 'remember-annotation-functions 'planner-annotation-functions) | ||
| 229 | (defcustom remember-annotation-functions | ||
| 230 | (if (boundp 'planner-annotation-functions) | ||
| 231 | planner-annotation-functions | ||
| 232 | '(buffer-file-name)) | ||
| 233 | "Hook that returns an annotation to be inserted into the remember buffer. | ||
| 234 | If you have planner.el, it's nice to set this to | ||
| 235 | `planner-annotation-functions'." | ||
| 236 | :type 'hook | ||
| 237 | :group 'remember) | ||
| 238 | |||
| 239 | (defvar remember-annotation nil | ||
| 240 | "Current annotation.") | ||
| 241 | (defvar remember-initial-contents nil | ||
| 242 | "Initial contents to place into *Remember* buffer.") | ||
| 243 | (defvar remember-before-remember-hook nil | ||
| 244 | "Functions run before switching to the *Remember* buffer.") | ||
| 245 | |||
| 246 | (defcustom remember-run-all-annotation-functions-flag nil | ||
| 247 | "Non-nil means use all annotations returned by | ||
| 248 | `remember-annotation-functions'." | ||
| 249 | :type 'boolean | ||
| 250 | :group 'remember) | ||
| 251 | |||
| 252 | ;;;###autoload | ||
| 253 | (defun remember (&optional initial) | ||
| 254 | "Remember an arbitrary piece of data. | ||
| 255 | With a prefix, uses the region as INITIAL." | ||
| 256 | (interactive | ||
| 257 | (list (when current-prefix-arg | ||
| 258 | (buffer-substring (point) (mark))))) | ||
| 259 | (funcall (if remember-in-new-frame | ||
| 260 | #'frame-configuration-to-register | ||
| 261 | #'window-configuration-to-register) remember-register) | ||
| 262 | (let* ((annotation | ||
| 263 | (if remember-run-all-annotation-functions-flag | ||
| 264 | (mapconcat 'identity | ||
| 265 | (delq nil | ||
| 266 | (mapcar 'funcall remember-annotation-functions)) | ||
| 267 | "\n") | ||
| 268 | (run-hook-with-args-until-success | ||
| 269 | 'remember-annotation-functions))) | ||
| 270 | (buf (get-buffer-create remember-buffer))) | ||
| 271 | (run-hooks 'remember-before-remember-hook) | ||
| 272 | (funcall (if remember-in-new-frame | ||
| 273 | #'switch-to-buffer-other-frame | ||
| 274 | #'switch-to-buffer-other-window) buf) | ||
| 275 | (if remember-in-new-frame | ||
| 276 | (set-window-dedicated-p | ||
| 277 | (get-buffer-window (current-buffer) (selected-frame)) t)) | ||
| 278 | (remember-mode) | ||
| 279 | (when (= (point-max) (point-min)) | ||
| 280 | (when initial (insert initial)) | ||
| 281 | (setq remember-annotation annotation) | ||
| 282 | (when remember-initial-contents (insert remember-initial-contents)) | ||
| 283 | (when (and (stringp annotation) | ||
| 284 | (not (equal annotation ""))) | ||
| 285 | (insert "\n\n" annotation)) | ||
| 286 | (setq remember-initial-contents nil) | ||
| 287 | (goto-char (point-min))) | ||
| 288 | (message "Use C-c C-c to remember the data."))) | ||
| 289 | |||
| 290 | ;;;###autoload | ||
| 291 | (defun remember-other-frame (&optional initial) | ||
| 292 | "Call `remember' in another frame." | ||
| 293 | (interactive | ||
| 294 | (list (when current-prefix-arg | ||
| 295 | (buffer-substring (point) (mark))))) | ||
| 296 | (let ((remember-in-new-frame t)) | ||
| 297 | (remember initial))) | ||
| 298 | |||
| 299 | (defsubst remember-time-to-seconds (time) | ||
| 300 | "Convert TIME to a floating point number." | ||
| 301 | (+ (* (car time) 65536.0) | ||
| 302 | (cadr time) | ||
| 303 | (/ (or (car (cdr (cdr time))) 0) 1000000.0))) | ||
| 304 | |||
| 305 | (defsubst remember-mail-date (&optional rfc822-p) | ||
| 306 | "Return a simple date. Nothing fancy." | ||
| 307 | (if rfc822-p | ||
| 308 | (format-time-string "%a, %e %b %Y %T %z" (current-time)) | ||
| 309 | (format-time-string "%c" (current-time)))) | ||
| 310 | |||
| 311 | (defun remember-buffer-desc () | ||
| 312 | "Using the first line of the current buffer, create a short description." | ||
| 313 | (buffer-substring (point-min) | ||
| 314 | (save-excursion | ||
| 315 | (goto-char (point-min)) | ||
| 316 | (end-of-line) | ||
| 317 | (if (> (- (point) (point-min)) 60) | ||
| 318 | (goto-char (+ (point-min) 60))) | ||
| 319 | (point)))) | ||
| 320 | |||
| 321 | ;; Remembering to UNIX mailboxes | ||
| 322 | |||
| 323 | (defcustom remember-mailbox "~/Mail/remember" | ||
| 324 | "*The file in which to store remember data as mail." | ||
| 325 | :type 'file | ||
| 326 | :group 'remember) | ||
| 327 | |||
| 328 | (defcustom remember-default-priority "medium" | ||
| 329 | "*The default priority for remembered mail messages." | ||
| 330 | :type 'string | ||
| 331 | :group 'remember) | ||
| 332 | |||
| 333 | (defun remember-store-in-mailbox () | ||
| 334 | "Store remember data as if it were incoming mail. | ||
| 335 | In which case `remember-mailbox' should be the name of the mailbox. | ||
| 336 | Each piece of psuedo-mail created will have an `X-Todo-Priority' | ||
| 337 | field, for the purpose of appropriate splitting." | ||
| 338 | (let ((who (read-string "Who is this item related to? ")) | ||
| 339 | (moment | ||
| 340 | (format "%.0f" (remember-time-to-seconds (current-time)))) | ||
| 341 | (desc (remember-buffer-desc)) | ||
| 342 | (text (buffer-string))) | ||
| 343 | (with-temp-buffer | ||
| 344 | (insert (format " | ||
| 345 | From %s %s | ||
| 346 | Date: %s | ||
| 347 | From: %s | ||
| 348 | Message-Id: <remember-%s@%s> | ||
| 349 | X-Todo-Priority: %s | ||
| 350 | To: %s <%s> | ||
| 351 | Subject: %s\n\n" | ||
| 352 | (user-login-name) | ||
| 353 | (remember-mail-date) | ||
| 354 | (remember-mail-date t) | ||
| 355 | who | ||
| 356 | moment (system-name) | ||
| 357 | remember-default-priority | ||
| 358 | (user-full-name) user-mail-address | ||
| 359 | desc)) | ||
| 360 | (let ((here (point))) | ||
| 361 | (insert text) | ||
| 362 | (unless (bolp) | ||
| 363 | (insert "\n")) | ||
| 364 | (insert "\n") | ||
| 365 | (goto-char here) | ||
| 366 | (while (re-search-forward "^\\(From[: ]\\)" nil t) | ||
| 367 | (replace-match ">\\1"))) | ||
| 368 | (append-to-file (point-min) (point-max) remember-mailbox) | ||
| 369 | t))) | ||
| 370 | |||
| 371 | (custom-add-option 'remember-handler-functions 'remember-store-in-mailbox) | ||
| 372 | |||
| 373 | ;; Remembering to plain files | ||
| 374 | |||
| 375 | (defcustom remember-data-file "~/.notes" | ||
| 376 | "*The file in which to store unprocessed data." | ||
| 377 | :type 'file | ||
| 378 | :group 'remember) | ||
| 379 | |||
| 380 | (defcustom remember-leader-text "** " | ||
| 381 | "*The text used to begin each remember item." | ||
| 382 | :type 'string | ||
| 383 | :group 'remember) | ||
| 384 | |||
| 385 | (defun remember-append-to-file () | ||
| 386 | "Remember, with description DESC, the given TEXT." | ||
| 387 | (let ((text (buffer-string)) | ||
| 388 | (desc (remember-buffer-desc))) | ||
| 389 | (with-temp-buffer | ||
| 390 | (insert "\n" remember-leader-text (current-time-string) | ||
| 391 | " (" desc ")\n\n" text) | ||
| 392 | (if (not (bolp)) | ||
| 393 | (insert "\n")) | ||
| 394 | (if (find-buffer-visiting remember-data-file) | ||
| 395 | (let ((remember-text (buffer-string))) | ||
| 396 | (set-buffer (get-file-buffer remember-data-file)) | ||
| 397 | (save-excursion | ||
| 398 | (goto-char (point-max)) | ||
| 399 | (insert remember-text) | ||
| 400 | (when remember-save-after-remembering (save-buffer)))) | ||
| 401 | (append-to-file (point-min) (point-max) remember-data-file))))) | ||
| 402 | |||
| 403 | (custom-add-option 'remember-handler-functions 'remember-append-to-file) | ||
| 404 | |||
| 405 | ;;;###autoload | ||
| 406 | (defun remember-region (&optional beg end) | ||
| 407 | "Remember the data from BEG to END. | ||
| 408 | If called from within the remember buffer, BEG and END are ignored, | ||
| 409 | and the entire buffer will be remembered. | ||
| 410 | |||
| 411 | This function is meant to be called from the *Remember* buffer. | ||
| 412 | If you want to remember a region, supply a universal prefix to | ||
| 413 | `remember' instead. For example: C-u M-x remember." | ||
| 414 | ;; Sacha: I have no idea where remember.el gets this context information, but | ||
| 415 | ;; you can just use remember-annotation-functions. | ||
| 416 | (interactive) | ||
| 417 | (let ((b (or beg (min (point) (or (mark) (point-min))))) | ||
| 418 | (e (or end (max (point) (or (mark) (point-max)))))) | ||
| 419 | (save-restriction | ||
| 420 | (narrow-to-region b e) | ||
| 421 | (if remember-all-handler-functions | ||
| 422 | (run-hooks 'remember-handler-functions) | ||
| 423 | (run-hook-with-args-until-success 'remember-handler-functions)) | ||
| 424 | (remember-destroy)))) | ||
| 425 | |||
| 426 | ;;;###autoload | ||
| 427 | (defun remember-clipboard () | ||
| 428 | "Remember the contents of the current clipboard. | ||
| 429 | Most useful for remembering things from Netscape or other X Windows | ||
| 430 | application." | ||
| 431 | (interactive) | ||
| 432 | (remember (current-kill 0))) | ||
| 433 | |||
| 434 | ;;;###autoload | ||
| 435 | (defun remember-buffer () | ||
| 436 | "Remember the contents of the current buffer." | ||
| 437 | (interactive) | ||
| 438 | (remember-region (point-min) (point-max))) | ||
| 439 | |||
| 440 | ;;;###autoload | ||
| 441 | (defun remember-destroy () | ||
| 442 | "Destroy the current *Remember* buffer." | ||
| 443 | (interactive) | ||
| 444 | (when (equal remember-buffer (buffer-name)) | ||
| 445 | (kill-buffer (current-buffer)) | ||
| 446 | (jump-to-register remember-register))) | ||
| 447 | |||
| 448 | ;;; Internal Functions: | ||
| 449 | |||
| 450 | (defvar remember-mode-map () | ||
| 451 | "Keymap used in Remember mode.") | ||
| 452 | (when (not remember-mode-map) | ||
| 453 | (setq remember-mode-map (make-sparse-keymap)) | ||
| 454 | (define-key remember-mode-map "\C-x\C-s" 'remember-buffer) | ||
| 455 | (define-key remember-mode-map "\C-c\C-c" 'remember-buffer) | ||
| 456 | (define-key remember-mode-map "\C-c\C-k" 'remember-destroy)) | ||
| 457 | |||
| 458 | (defun remember-mode () | ||
| 459 | "Major mode for output from \\[remember]. | ||
| 460 | \\<remember-mode-map>This buffer is used to collect data that you want | ||
| 461 | remember. Just hit \\[remember-region] when you're done entering, and | ||
| 462 | it will go ahead and file the data for latter retrieval, and possible | ||
| 463 | indexing. \\{remember-mode-map}" | ||
| 464 | (interactive) | ||
| 465 | (kill-all-local-variables) | ||
| 466 | (indented-text-mode) | ||
| 467 | (use-local-map remember-mode-map) | ||
| 468 | (setq major-mode 'remember-mode | ||
| 469 | mode-name "Remember") | ||
| 470 | (run-hooks 'remember-mode-hook)) | ||
| 471 | |||
| 472 | ;;; remember.el ends here | ||