gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memo.el - quick access to your memos (with completion)


From: Sebastian Tennant
Subject: memo.el - quick access to your memos (with completion)
Date: Fri, 28 Oct 2005 00:30:02 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20050602)

;;; Copyright (C) 2005 Sebastian Tennant

;;; Author: Sebastian Tennant <address@hidden>

;;; Version: 0.01

;;; This file is not part of GNU Emacs.

;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;;; 02110-1301 USA

;; Commentary:
;;
;; EITHER CREATE THE DIRECTORY ~/memo, OR MODIFY THIS SOURCE
;; WHERE INDICATED, BEFORE ATTEMPTING TO USE
;;
;; Create a new memo, open an existing memo (with completion), or open the 
default memo.
;; Requires custom setting of a memo directory and the default memo file in the 
elisp source.
;; Completion is available at the `Subject:' prompt.  No subject will create or 
read the default
;; memo file.  Point is placed at the end of exisitng memo files for 
convenience.
;;
;; Place this file in your load-path and add the following to your ~/.emacs:
;; (autoload 'memo "memo" "Quick access to my memos (with completion)." t nil)
;;
;; Once loaded, `M-x memo' is all that is required.
;;
;; memo.el - code follows this line

(defun memo-defvars ()
  (defvar memo-directory (file-name-as-directory "~/memo")) ;modify ~/memo as 
desired
  (defvar memo-directory-obarray (make-vector 127 0)))

(defun memo-populate-or-update-memo-directory-obarray ()
  (let ((file-name-list (directory-files memo-directory nil "^[^.#][0-9A-Za-z]" 
t)))
    (dolist (file-name file-name-list)
      (intern file-name memo-directory-obarray))))

(defun memo (subject)
  "Create a new memo, open an existing memo (with completion), or open the 
default memo.
Requires custom setting of memo directory and default memo file in elisp source.
Completion is available at the `Subject:' prompt.  No subject will create or 
read the default
memo file.  Point is placed at the end of exisitng memo files for convenience."
  (interactive (progn (memo-defvars) 
(memo-populate-or-update-memo-directory-obarray)
                      (list (completing-read "Subject: " memo-directory-obarray 
nil nil nil nil"Miscellaneous" nil))))
    (set-buffer (find-file-noselect (concat memo-directory subject) nil))
    (goto-char (point-max))
    (switch-to-buffer (buffer-name)))

;; memo.el - end of code





reply via email to

[Prev in Thread] Current Thread [Next in Thread]