lsdb-0.11/0040755000175000017500000000000007777134226011100 5ustar uenouenolsdb-0.11/.cvsignore0100644000175000017500000000001307467217105013061 0ustar uenouenoChangeLog lsdb-0.11/.tdldb0100644000175000017500000000142707644433536012172 0ustar uenoueno>' Known bugs>'Feature request >(9Expire entries>(].Make `lsdb-entry-type-alist' more configurable>(>HRCompletion with migemo (cf. <20030324.185831.74381239.shirai@rdmg.mgcs.mei.co.jp>)>,WCheck duplication using 'net entry (cf. <20021002191221U.1000@pine.kuee.kyoto-u.ac.jp>)> Add URL link>1Toggle show all entries whose scores are negative>HcDisplay X-Face in the summary buffer (cf. )>8(Kill X-Face decoding process with itimer>9@Support Face: header (cf. )>' Documentationlsdb-0.11/LSDB-CFG0100644000175000017500000000226307462023041012123 0ustar uenoueno;;; -*-Emacs-Lisp-*- ;; LSDB-CFG: installation setting about LSDB. ;;; Code: (add-to-list 'load-path (expand-file-name ".")) (condition-case nil (require 'install) (error (error "Please install APEL."))) ;;; @ Please specify prefix of install directory. ;;; ;; Please specify install path prefix. ;; If it is omitted, shared directory (maybe /usr/local is used). (defvar PREFIX install-prefix) ;;(setq PREFIX "~/") ;; Please specify LSDB prefix [optional] (setq LSDB_PREFIX "lsdb") ;;; @ optional settings ;;; ;; It is generated by automatically. Please set variable `PREFIX'. ;; If you don't like default directory tree, please set it. (defvar LISPDIR (install-detect-elisp-directory PREFIX)) ;; (setq install-default-elisp-directory "~/lib/emacs/lisp") (setq LSDB_DIR (expand-file-name LSDB_PREFIX LISPDIR)) (defvar PACKAGEDIR (if (boundp 'early-packages) (let ((dirs (append (if early-package-load-path early-packages) (if late-package-load-path late-packages) (if last-package-load-path last-packages))) dir) (while (not (file-exists-p (setq dir (car dirs)))) (setq dirs (cdr dirs))) dir))) ;;; LSDB-CFG ends here lsdb-0.11/LSDB-ELS0100644000175000017500000000042407462562762012166 0ustar uenoueno;;; -*-Emacs-Lisp-*- ;; LSDB-ELS: list of LSDB modules to install ;;; Code: (setq lsdb-modules-to-compile '(lsdb)) (setq lsdb-modules-not-to-compile nil) (setq lsdb-modules (append lsdb-modules-to-compile lsdb-modules-not-to-compile)) ;;; LSDB-ELS ends here lsdb-0.11/LSDB-MK0100644000175000017500000000356407462023041012040 0ustar uenoueno;;; -*-Emacs-Lisp-*- ;; LSDB-MK: installer for LSDB. ;;; Code: (defun config-lsdb () (let (prefix lisp-dir) (and (setq prefix (car command-line-args-left)) (or (string-equal "NONE" prefix) (defvar PREFIX prefix))) (setq command-line-args-left (cdr command-line-args-left)) (and (setq lisp-dir (car command-line-args-left)) (or (string-equal "NONE" lisp-dir) (defvar LISPDIR lisp-dir))) (setq command-line-args-left (cdr command-line-args-left)) (load-file "LSDB-CFG") (load-file "LSDB-ELS") (princ (format "PREFIX=%s LISPDIR=%s\n" PREFIX LISPDIR)))) (defun compile-lsdb () (config-lsdb) (compile-elisp-modules lsdb-modules ".")) (defun install-lsdb () (config-lsdb) (install-elisp-modules lsdb-modules "./" LSDB_DIR)) (defun config-lsdb-package () (let (package-dir) (and (setq package-dir (car command-line-args-left)) (or (string= "NONE" package-dir) (defvar PACKAGEDIR package-dir))) (setq command-line-args-left (cdr command-line-args-left)) (load-file "LSDB-CFG") (load-file "LSDB-ELS") (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR)))) (defun compile-lsdb-package () (config-lsdb-package) (setq autoload-package-name "lsdb") (add-to-list 'command-line-args-left ".") (batch-update-directory) (add-to-list 'command-line-args-left ".") (Custom-make-dependencies) (compile-elisp-modules (append lsdb-modules-to-compile '(auto-autoloads custom-load)) ".")) (defun install-lsdb-package () (config-lsdb-package) (install-elisp-modules (append lsdb-modules '(auto-autoloads custom-load)) "./" (expand-file-name LSDB_PREFIX (expand-file-name "lisp" PACKAGEDIR))) (if (file-exists-p "./auto-autoloads.el") (delete-file "./auto-autoloads.el")) (if (file-exists-p "./custom-load.el") (delete-file "./custom-load.el"))) ;;; LSDB-MK ends here lsdb-0.11/Makefile0100644000175000017500000000147307644433655012543 0ustar uenoueno# # Makefile for LSDB. # PACKAGE = lsdb API = 0.1 RELEASE = 0 RM = /bin/rm -f EMACS = emacs XEMACS = xemacs FLAGS = -batch -q -no-site-file -l LSDB-MK PREFIX = NONE LISPDIR = NONE PACKAGEDIR = NONE VERSION_SPECIFIC_LISPDIR = NONE GOMI = *.elc VERSION = $(API).$(RELEASE) elc: $(EMACS) $(FLAGS) -f compile-lsdb $(PREFIX) $(LISPDIR) install: elc $(EMACS) $(FLAGS) -f install-lsdb $(PREFIX) $(LISPDIR) package: $(XEMACS) $(FLAGS) -f compile-lsdb-package $(PACKAGEDIR) install-package: package $(XEMACS) $(FLAGS) -f install-lsdb-package $(PACKAGEDIR) ChangeLog: $(filter-out ChangeLog CVS, $(wildcard *)) cvs2cl --prune --no-wrap --usermap ./cvs2cl/usermap --gmt --stdout \ --ignore '\.tdldb' | \ ruby -p -i ./cvs2cl/fmtlog.rb > $@ .PHONY: clean distclean clean: -$(RM) $(GOMI) distclean: -$(RM) ChangeLog lsdb-0.11/README0100644000175000017500000001540507775215043011755 0ustar uenoueno-*- mode: text -*- .* What's LSDB LSDB (The Lovely Sister Database) is a rolodex-like database program for SEMI based MUA. It intends to be a lightweight replacement for BBDB (The Insidious Big Brother Database). Unfortunately, it currently doesn't support the all features of BBDB. .* Requirements LSDB works under following environment at least: * Emacs 20.7 * XEmacs 21.4 or later You will also need the following libraries: * APEL 10.2 or later * ftp://ftp.m17n.org/pub/mule/apel/ * FLIM 1.12 or later * ftp://ftp.m17n.org/pub/mule/flim/ .* Installation .. (a) run in expanded place If you don't want to install other directories, please do only following: % make You can specify the emacs command name, for example % make install EMACS=xemacs If `EMACS=...' is omitted, EMACS=emacs is used. .. (b) make install If you want to install other directories, please do following: % make install .. (c) install as a XEmacs package If you want to install to XEmacs package directory, please do following: % make install-package .* MUA Specific Installation There are the convenient ways to get the LSDB functions insinuate into some particular MUA. Only Semi-gnus and Wanderlust are currently supported. If you use Semi-gnus or its variant, put the following lines into your ~/.gnus and you will get the functions in this package autoloaded. (autoload 'lsdb-gnus-insinuate "lsdb") (autoload 'lsdb-gnus-insinuate-message "lsdb") (add-hook 'gnus-startup-hook 'lsdb-gnus-insinuate) ;; If you are using T-gnus 6.15.7 or later, type M-x ;; customize-variable and set message-expand-name-function to ;; lsdb-complete-name, instead of adding the following lines. ;; (add-hook 'message-setup-hook ;; (lambda () ;; (define-key message-mode-map "\M-\t" 'lsdb-complete-name))) (add-hook 'gnus-summary-mode-hook (lambda () (define-key gnus-summary-mode-map ":" 'lsdb-toggle-buffer))) If you use Wanderlust, put the following lines into your ~/.wl: (require 'lsdb) (lsdb-wl-insinuate) (add-hook 'wl-draft-mode-hook (lambda () (define-key wl-draft-mode-map "\M-\t" 'lsdb-complete-name))) (add-hook 'wl-summary-mode-hook (lambda () (define-key wl-summary-mode-map ":" 'lsdb-wl-toggle-buffer))) If you use Mew, put the following lines into your ~/.mew: (autoload 'lsdb-mew-insinuate "lsdb") (add-hook 'mew-init-hook 'lsdb-mew-insinuate) (add-hook 'mew-draft-mode-hook (lambda () (define-key mew-draft-header-map "\M-I" 'lsdb-complete-name))) (add-hook 'mew-summary-mode-hook (lambda () (define-key mew-summary-mode-map "L" 'lsdb-toggle-buffer))) If you use MU-CITE, put the following lines into your ~/.emacs: (autoload 'lsdb-mu-insinuate "lsdb") (eval-after-load "mu-cite" '(lsdb-mu-insinuate)) If you want to use x-face-e21 instead of the LSDB's builtin X-Face functions, set lsdb-insert-x-face-function as follows: (setq lsdb-insert-x-face-function (lambda (x-face) (require 'x-face-e21) (insert-image (x-face-create-image x-face :scale-factor 0.5)))) .* Bug Reports If you found bugs, please drop a note to the Lsdb-info Mailing List: * lsdb-info@lists.sourceforge.jp .* File Release Latest version of LSDB can be found at: * http://sourceforge.jp/projects/lsdb/files/ .* API The API is simple and not written in a way that maximizes flexibility. .. Record Management . : Gathering Records . , lsdb-update-records lsdb-update-records is called from the buffer which contains raw contents of MIME entity. It returns a list of records gathered from the buffer. . : Display Records . , lsdb-display-record lsdb-display-record displays the formatted contents of the record within the popup window. If you want to display multiple records, use lsdb-display-records instead. .. Internal Data Model . : Primary Hash Table There are two kinds of hash tables used in LSDB: a primary hash table and secondary hash tables. lsdb-hash-table is the primary hash table which holds mappings for names and record objects. You can operate on LSDB hash tables in similar fashion to CL's hash-table API: lsdb-puthash (for puthash), lsdb-gethash (for gethash), and lsdb-maphash (for maphash) are available. Here is an example to get the record object for "Daiki Ueno": (lsdb-gethash "Daiki Ueno" lsdb-hash-table) => ((last-modified . "2002-04-23") (creation-date . "2002-04-26") (net "ueno@unixuser.org") (mailing-list "emacs-mime-ja") (attribution . "DU") (user-agent "T-gnus/6.15.6 (based on Oort Gnus v0.06) (revision 03)")) . : Secondary Hash Tables LSDB can also have one or more secondary hash tables. These hash tables are mainly used to define additional relationships between record objects and their entries. For example, lsdb-address-cache is one of secondary hash table which maintains mappings of mail addresses to record names. The variable lsdb-secondary-hash-tables is a list of symbols for _maintained_ secondary hash tables. When the primary hash table is loaded or saved, these hash tables are updated automatically. . , Operate on Secondary Hash Tables You will need to follow the manner of the LSDB hooks. . ; lsdb-lookup-full-name-functions List of functions to pick up the existing full-name of the sender. The sender is passed to each function as the argument. . ; lsdb-update-record-functions List of functions called after a record is modified. The modified record is passed to each function as the argument. .* Development .. CVS Development of LSDB uses CVS. So latest developing version is available at CVS. . : cvs login (first time only) % cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root login CVS password: [CR] # NULL string . : checkout % cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root checkout lsdb If you would like to join CVS based development, please send mail to cvs@cvs.m17n.org with your account name and your public key for ssh. cvsroot is :ext:cvs@cvs.m17n.org:/cvs/root. If you cannot use ssh, please send UNIX /etc/passwd style crypted password. you can commit with the cvsroot :pserver:@cvs.m17n.org:/cvs/root. We hope you will join the open development. .* Authors * Daiki Ueno * Hideyuki SHIRAI (support for Mew) * Yuuichi Teranishi * TSUCHIYA Masatoshi .* Local emacs vars. The following `allout-layout' local variable setting: - closes all topics from the first topic to just before the third-to-last, - shows the children of the third to last (config vars) - and the second to last (code section), - and closes the last topic (this local-variables section). Local variables: allout-layout: (0 : -1 -1 0) End: lsdb-0.11/bbdb-to-lsdb.el0100644000175000017500000000341007463416430013640 0ustar uenoueno;;; bbdb-to-lsdb.el --- the data conversion utility from BBDB to LSDB ;; Copyright (C) 2002 Daiki Ueno ;; Author: Daiki Ueno ;; Keywords: adress book ;; This file is part of the Lovely Sister Database. ;; 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; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; To convert your ~/.bbdb to ~/.lsdb, type the following command from shell: ;;; emacs -batch -l ./bbdb-to-lsdb.el ;;; Code: (require 'bbdb) (require 'lsdb) (let ((bbdb-records (bbdb-records)) value) (lsdb-maybe-load-hash-tables) (while bbdb-records (when (setq value (bbdb-record-net (car bbdb-records))) (lsdb-update-record (list (or (bbdb-record-name (car bbdb-records)) (car value)) (car value)) (nconc (if (cdr value) (list (cons 'net (cdr value)))) (if (setq value (bbdb-record-aka (car bbdb-records))) (list (cons 'aka value))) (if (setq value (bbdb-record-company (car bbdb-records))) (list (cons 'company value))) (bbdb-record-raw-notes (car bbdb-records))))) (setq bbdb-records (cdr bbdb-records))) (lsdb-mode-save t)) ;;; bbdb-to-lsdb.el ends here lsdb-0.11/lsdb.el0100644000175000017500000017372607777133705012364 0ustar uenoueno;;; lsdb.el --- the Lovely Sister Database ;; Copyright (C) 2002 Daiki Ueno ;; Author: Daiki Ueno ;; Keywords: address book ;; This file is part of the Lovely Sister Database. ;; 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; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;;; For Semi-gnus: ;;; (autoload 'lsdb-gnus-insinuate "lsdb") ;;; (autoload 'lsdb-gnus-insinuate-message "lsdb") ;;; (add-hook 'gnus-startup-hook 'lsdb-gnus-insinuate) ;;; (add-hook 'message-setup-hook ;;; (lambda () ;;; (define-key message-mode-map "\M-\t" 'lsdb-complete-name))) ;;; (add-hook 'gnus-summary-mode-hook ;;; (lambda () ;;; (define-key gnus-summary-mode-map ":" 'lsdb-toggle-buffer))) ;;; For Wanderlust, put the following lines into your ~/.wl: ;;; (autoload 'lsdb-wl-insinuate "lsdb") ;;; (add-hook 'wl-init-hook 'lsdb-wl-insinuate) ;;; (add-hook 'wl-draft-mode-hook ;;; (lambda () ;;; (define-key wl-draft-mode-map "\M-\t" 'lsdb-complete-name))) ;;; (add-hook 'wl-summary-mode-hook ;;; (lambda () ;;; (define-key wl-summary-mode-map ":" 'lsdb-wl-toggle-buffer))) ;;; For Mew, put the following lines into your ~/.mew: ;;; (autoload 'lsdb-mew-insinuate "lsdb") ;;; (add-hook 'mew-init-hook 'lsdb-mew-insinuate) ;;; (add-hook 'mew-draft-mode-hook ;;; (lambda () ;;; (define-key mew-draft-header-map "\M-I" 'lsdb-complete-name))) ;;; (add-hook 'mew-summary-mode-hook ;;; (lambda () ;;; (define-key mew-summary-mode-map "L" 'lsdb-toggle-buffer))) ;;; Code: (require 'poem) (require 'pces) (require 'mime) (require 'static) ;;;_* USER CUSTOMIZATION VARIABLES: (defgroup lsdb nil "The Lovely Sister Database." :group 'news :group 'mail) (defcustom lsdb-file (expand-file-name "~/.lsdb") "The name of the Lovely Sister Database file." :group 'lsdb :type 'file) (defcustom lsdb-file-coding-system (find-coding-system 'ctext) "Coding system for `lsdb-file'." :group 'lsdb :type 'symbol) (defcustom lsdb-sender-headers "From\\|Resent-From" "List of headers to search for senders." :group 'lsdb :type 'list) (defcustom lsdb-recipients-headers "Resent-To\\|Resent-Cc\\|Reply-To\\|To\\|Cc\\|Bcc" "List of headers to search for recipients." :group 'lsdb :type 'list) (defcustom lsdb-interesting-header-alist `(("Organization" nil organization) ("\\(X-\\)?User-Agent\\|X-Mailer\\|X-Newsreader" nil user-agent) ("\\(X-\\)?ML-Name" nil mailing-list) ("List-Id" "\\(.*\\)[ \t]+<[^>]+>\\'" mailing-list "\\1") ("X-Sequence" "\\(.*\\)[ \t]+[0-9]+\\'" mailing-list "\\1") ("Delivered-To" "mailing list[ \t]+\\([^@]+\\)@.*" mailing-list "\\1") ("\\(X-URL\\|X-URI\\)" nil www) ("X-Attribution\\|X-cite-me" nil attribution) ("X-Face" nil x-face) ("Face" nil face) (,lsdb-sender-headers nil sender)) "Alist of headers we are interested in. The format of elements of this list should be (FIELD-NAME REGEXP ENTRY STRING) where the last three elements are optional." :group 'lsdb :type 'list) (defcustom lsdb-entry-type-alist '((net 5 ?,) (creation-date 2 ?. t) (last-modified 3 ?. t) (mailing-list 4 ?,) (attribution 4 ?.) (organization 4) (www 4) (aka 4 ?,) (score -1) (x-face -1) (face -1) (sender -1)) "Alist of entry types for presentation. The format of elements of this list should be (ENTRY SCORE [CLASS READ-ONLY]) where the last two elements are optional. Possible values for CLASS are `?.' and '?,'. If CLASS is `?.', the entry takes a unique value which is overridden by newly assigned one by `lsdb-mode-edit-entry' or such a command. If CLASS is `?,', the entry can have multiple values separated by commas. If the fourth element READ-ONLY is non-nil, it is assumed that the entry cannot be modified." :group 'lsdb :type 'list) (defcustom lsdb-decode-field-body-function #'lsdb-decode-field-body "Field body decoder." :group 'lsdb :type 'function) (defcustom lsdb-canonicalize-full-name-function #'lsdb-canonicalize-spaces-and-dots "Way to canonicalize full name." :group 'lsdb :type 'function) (defcustom lsdb-lookup-full-name-functions '(lsdb-lookup-full-name-from-address-cache) "List of functions to pick up the existing full-name of the sender. The sender is passed to each function as the argument." :group 'lsdb :type 'hook) (defcustom lsdb-after-update-record-functions '(lsdb-update-address-cache) "List of functions called after a record is updated. The updated record is passed to each function as the argument." :group 'lsdb :type 'hook) (defcustom lsdb-after-delete-record-functions '(lsdb-delete-address-cache) "List of functions called after a record is removed. The removed record is passed to each function as the argument." :group 'lsdb :type 'hook) (defcustom lsdb-secondary-hash-tables '(lsdb-address-cache) "List of the hash tables for reverse lookup" :group 'lsdb :type 'list) (defcustom lsdb-window-max-height 7 "Maximum number of lines used to display LSDB record." :group 'lsdb :type 'integer) (defcustom lsdb-x-face-image-type nil "A image type of displayed x-face. If non-nil, supersedes the return value of `lsdb-x-face-available-image-type'." :group 'lsdb :type 'symbol) (defcustom lsdb-x-face-command-alist '((pbm "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | pnmscale 0.5") (xpm "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | pnmscale 0.5 | ppmtoxpm")) "An alist from an image type to a command to be executed to display an X-Face header. The command will be executed in a sub-shell asynchronously. The compressed face will be piped to this command." :group 'lsdb :type 'list) (defcustom lsdb-insert-x-face-function (if (static-if (featurep 'xemacs) (featurep 'xpm) (and (>= emacs-major-version 21) (fboundp 'image-type-available-p) (or (image-type-available-p 'pbm) (image-type-available-p 'xpm)))) #'lsdb-insert-x-face-asynchronously) "Function to display X-Face." :group 'lsdb :type 'function) (defcustom lsdb-face-image-type nil "A image type of displayed face. If non-nil, supersedes the return value of `lsdb-x-face-available-image-type'." :group 'lsdb :type 'symbol) (defcustom lsdb-face-command-alist '((png "pngtopnm | pnmscale 0.5 | pnmtopng") (xpm "pngtopnm | pnmscale 0.5 | ppmtoxpm")) "An alist from an image type to a command to be executed to display a Face header. The command will be executed in a sub-shell asynchronously. The decoded field-body (actually a PNG data) will be piped to this command." :group 'lsdb :type 'list) (defcustom lsdb-insert-face-function (if (static-if (featurep 'xemacs) (or (featurep 'png) (featurep 'xpm)) (and (>= emacs-major-version 21) (fboundp 'image-type-available-p) (or (image-type-available-p 'png) (image-type-available-p 'xpm)))) #'lsdb-insert-face-asynchronously) "Function to display Face." :group 'lsdb :type 'function) (defcustom lsdb-print-record-hook '(lsdb-expose-x-face lsdb-expose-face) "A hook called after a record is displayed." :group 'lsdb :type 'hook) (defcustom lsdb-display-records-sort-predicate nil "A predicate to sort records." :group 'lsdb :type 'function) (defcustom lsdb-display-records-belong-to-user t "Non-nil means LSDB displays records belong to yourself. When this option is equal to nil and a message is sent by the user whose address is `user-mail-address', the LSDB record for the To: line will be shown instead of the one for the From: line." :group 'lsdb :type 'boolean) (defcustom lsdb-pop-up-windows t "Non-nil means LSDB should make new windows to display records." :group 'lsdb :type 'boolean) (defgroup lsdb-edit-form nil "A mode for editing forms." :group 'lsdb) (defcustom lsdb-edit-form-mode-hook nil "Hook run in `lsdb-edit-form-mode' buffers." :group 'lsdb-edit-form :type 'hook) (defcustom lsdb-shell-file-name "/bin/sh" "File name to load inferior shells from. Bourne shell or its equivalent \(not tcsh) is needed for \"2>\"." :group 'lsdb :type 'string) (defcustom lsdb-shell-command-switch "-c" "Switch used to have the shell execute its command line argument." :group 'lsdb :type 'string) (defcustom lsdb-verbose t "If non-nil, confirm user to submit changes to lsdb-hash-table." :type 'boolean :group 'lsdb) (defcustom lsdb-strip-address nil "If non-nil, strip display-name from sender address before completion." :group 'lsdb :type 'boolean) (defcustom lsdb-use-migemo nil "If non-nil, use `migemo' when complete address." :type 'boolean :group 'lsdb) ;;;_. Faces (defface lsdb-header-face '((t (:underline t))) "Face for the file header line in `lsdb-mode'." :group 'lsdb) (defvar lsdb-header-face 'lsdb-header-face) (defface lsdb-field-name-face '((((class color) (background dark)) (:foreground "PaleTurquoise" :bold t)) (t (:bold t))) "Face for the message header line in `lsdb-mode'." :group 'lsdb) (defvar lsdb-field-name-face 'lsdb-field-name-face) (defface lsdb-field-body-face '((((class color) (background dark)) (:foreground "turquoise" :italic t)) (t (:italic t))) "Face for the message header line in `lsdb-mode'." :group 'lsdb) (defvar lsdb-field-body-face 'lsdb-field-body-face) (defconst lsdb-font-lock-keywords '(("^\\sw[^\r\n]*" (0 lsdb-header-face)) ("^\t\t.*$" (0 lsdb-field-body-face)) ("^\t\\([^\t:]+:\\)[ \t]*\\(.*\\)$" (1 lsdb-field-name-face) (2 lsdb-field-body-face)))) (put 'lsdb-mode 'font-lock-defaults '(lsdb-font-lock-keywords t)) ;;;_* CODE - no user customizations below ;;;_. Internal Variables (defvar lsdb-hash-table nil "Internal hash table to hold LSDB records.") (defvar lsdb-address-cache nil "The reverse lookup table for `lsdb-hash-table'. It represents address to full-name mapping.") (defvar lsdb-buffer-name "*LSDB*" "Buffer name to display LSDB record.") (defvar lsdb-hash-tables-are-dirty nil "Flag to indicate whether the internal hash tables need to be saved.") (defvar lsdb-known-entry-names (make-vector 29 0) "An obarray used to complete an entry name.") (defvar lsdb-temp-buffer-show-function #'lsdb-temp-buffer-show-function "Non-nil means call as function to display a help buffer. The function is called with one argument, the buffer to be displayed. Overrides `temp-buffer-show-function'.") ;;;_. Hash Table Emulation (if (and (fboundp 'make-hash-table) (subrp (symbol-function 'make-hash-table))) (progn (defalias 'lsdb-puthash 'puthash) (defalias 'lsdb-gethash 'gethash) (defalias 'lsdb-remhash 'remhash) (defalias 'lsdb-maphash 'maphash) (defalias 'lsdb-hash-table-size 'hash-table-size) (defalias 'lsdb-hash-table-count 'hash-table-count) (defalias 'lsdb-make-hash-table 'make-hash-table)) (defun lsdb-puthash (key value hash-table) "Hash KEY to VALUE in HASH-TABLE." ;; Obarray is regarded as an open hash table, as a matter of ;; fact, rehashing doesn't make sense. (let (new-obarray) (when (> (car hash-table) (* (length (nth 1 hash-table)) 0.7)) (setq new-obarray (make-vector (* (length (nth 1 hash-table)) 2) 0)) (mapatoms (lambda (symbol) (set (intern (symbol-name symbol) new-obarray) (symbol-value symbol))) (nth 1 hash-table)) (setcdr hash-table (list new-obarray))) (set (intern key (nth 1 hash-table)) value) (setcar hash-table (1+ (car hash-table))))) (defun lsdb-gethash (key hash-table &optional default) "Find hash value for KEY in HASH-TABLE. If there is no corresponding value, return DEFAULT (which defaults to nil)." (let ((symbol (intern-soft key (nth 1 hash-table)))) (if symbol (symbol-value symbol) default))) (defun lsdb-remhash (key hash-table) "Remove the entry for KEY from HASH-TABLE. Do nothing if there is no entry for KEY in HASH-TABLE." (unintern key (nth 1 hash-table)) (setcar hash-table (1- (car hash-table)))) (defun lsdb-maphash (function hash-table) "Map FUNCTION over entries in HASH-TABLE, calling it with two args, each key and value in HASH-TABLE. FUNCTION may not modify HASH-TABLE, with the one exception that FUNCTION may remhash or puthash the entry currently being processed by FUNCTION." (mapatoms (lambda (symbol) (funcall function (symbol-name symbol) (symbol-value symbol))) (nth 1 hash-table))) (defun lsdb-hash-table-size (hash-table) "Return the size of HASH-TABLE. This is the current number of slots in HASH-TABLE, whether occupied or not." (length (nth 1 hash-table))) (defalias 'lsdb-hash-table-count 'car) (defun lsdb-make-hash-table (&rest args) "Return a new empty hash table object." (list 0 (make-vector (or (plist-get args :size) 29) 0)))) ;;;_. Hash Table Reader/Writer (defconst lsdb-secondary-hash-table-start-format ";;; %S\n") (defsubst lsdb-secondary-hash-table-start (hash-table) (format lsdb-secondary-hash-table-start-format hash-table)) (eval-and-compile (condition-case nil (and ;; In XEmacs, hash tables can also be created by the lisp reader ;; using structure syntax. (read-from-string "#s(hash-table)") (defalias 'lsdb-read 'read)) (invalid-read-syntax (defun lsdb-read (&optional marker) "Read one Lisp expression as text from MARKER, return as Lisp object." (save-excursion (goto-char marker) (if (looking-at "^#s(") (let ((end-marker (progn (forward-char 2) ;skip "#s" (forward-sexp) ;move to the left paren (point-marker)))) (with-temp-buffer (buffer-disable-undo) (insert-buffer-substring (marker-buffer marker) marker end-marker) (goto-char (point-min)) (delete-char 2) (let ((object (read (current-buffer))) hash-table data) (if (eq 'hash-table (car object)) (progn (setq hash-table (lsdb-make-hash-table :size (plist-get (cdr object) 'size) :test 'equal) data (plist-get (cdr object) 'data)) (while data (lsdb-puthash (pop data) (pop data) hash-table)) hash-table) object)))) (read marker))))))) (defun lsdb-load-hash-tables () "Read the contents of `lsdb-file' into the internal hash tables." (let ((buffer (find-file-noselect lsdb-file)) tables) (unwind-protect (save-excursion (set-buffer buffer) (goto-char (point-min)) (re-search-forward "^#s(") (goto-char (match-beginning 0)) (setq lsdb-hash-table (lsdb-read (point-marker))) ;; Load the secondary hash tables following. (setq tables lsdb-secondary-hash-tables) (while tables (if (re-search-forward (concat "^" (lsdb-secondary-hash-table-start (car tables))) nil t) (set (car tables) (lsdb-read (point-marker)))) (setq tables (cdr tables)))) (kill-buffer buffer)))) (defun lsdb-insert-hash-table (hash-table) (insert "#s(hash-table size " ;; Reduce the actual size of the close hash table, because ;; XEmacs doesn't have a distinction between index-size and ;; hash-table-size. (number-to-string (lsdb-hash-table-count hash-table)) " test equal data (") (lsdb-maphash (lambda (key value) (let (print-level print-length) (insert (prin1-to-string key) " " (prin1-to-string value) " "))) hash-table) (insert "))")) (defun lsdb-save-hash-tables () "Write the records within the internal hash tables into `lsdb-file'." (let ((coding-system-for-write lsdb-file-coding-system) tables) (with-temp-file lsdb-file (if (and (or (featurep 'mule) (featurep 'file-coding)) lsdb-file-coding-system) (let ((coding-system-name (if (symbolp lsdb-file-coding-system) (symbol-name lsdb-file-coding-system) ;; XEmacs (static-if (featurep 'xemacs) (symbol-name (coding-system-name lsdb-file-coding-system)))))) (if coding-system-name (insert ";;; -*- mode: emacs-lisp; coding: " coding-system-name " -*-\n")))) (lsdb-insert-hash-table lsdb-hash-table) ;; Save the secondary hash tables following. (setq tables lsdb-secondary-hash-tables) (while tables (insert "\n" (lsdb-secondary-hash-table-start (car tables))) (lsdb-insert-hash-table (symbol-value (car tables))) (setq tables (cdr tables)))))) ;;;_. Mail Header Extraction (defun lsdb-fetch-fields (regexp) (save-excursion (goto-char (point-min)) (let ((case-fold-search t) field-bodies) (while (re-search-forward (concat "^\\(" regexp "\\):[ \t]*") nil t) (push (cons (match-string 1) (buffer-substring (point) (std11-field-end))) field-bodies)) (nreverse field-bodies)))) (defun lsdb-canonicalize-spaces-and-dots (string) (while (string-match " +\\|[\f\t\n\r\v]+\\|\\." string) (setq string (replace-match " " nil t string))) string) (defun lsdb-extract-address-components (string) (let ((components (std11-extract-address-components string))) (if (and (nth 1 components) ;; When parsing a group address, ;; std11-extract-address-components is likely to return ;; the ("GROUP" "") form. (not (equal (nth 1 components) ""))) (if (car components) (list (funcall lsdb-canonicalize-full-name-function (car components)) (nth 1 components)) (list (nth 1 components) (nth 1 components)))))) ;; stolen (and renamed) from nnheader.el (defun lsdb-decode-field-body (field-body field-name &optional mode max-column) (let ((multibyte enable-multibyte-characters)) (unwind-protect (progn (set-buffer-multibyte t) (mime-decode-field-body field-body (if (stringp field-name) (intern (capitalize field-name)) field-name) mode max-column)) (set-buffer-multibyte multibyte)))) ;;;_. Record Management (defun lsdb-rebuild-secondary-hash-tables (&optional force) (let ((tables lsdb-secondary-hash-tables)) (while tables (when (or force (not (symbol-value (car tables)))) (set (car tables) (lsdb-make-hash-table :test 'equal)) (setq lsdb-hash-tables-are-dirty t)) (setq tables (cdr tables)))) (if lsdb-hash-tables-are-dirty (lsdb-maphash (lambda (key value) (run-hook-with-args 'lsdb-after-update-record-functions (cons key value))) lsdb-hash-table))) (defun lsdb-maybe-load-hash-tables () (unless lsdb-hash-table (if (file-exists-p lsdb-file) (lsdb-load-hash-tables) (setq lsdb-hash-table (lsdb-make-hash-table :test 'equal))) (lsdb-rebuild-secondary-hash-tables))) ;;;_ : Fallback Lookup Functions ;;;_ , #1 Address Cache (defun lsdb-lookup-full-name-from-address-cache (sender) (lsdb-gethash (nth 1 sender) lsdb-address-cache)) (defun lsdb-update-address-cache (record) (let ((net (cdr (assq 'net record)))) (while net (lsdb-puthash (pop net) (car record) lsdb-address-cache)))) (defun lsdb-delete-address-cache (record) (let ((net (cdr (assq 'net record)))) (while net (lsdb-remhash (pop net) lsdb-address-cache)))) ;;;_ , #2 Iterate on the All Records (very slow) (defun lsdb-lookup-full-name-by-fuzzy-matching (sender) (let ((names (if (string-match "\\`\\(.+\\)[ \t]+\\(/[ \t]+\\|(\\([^)]+\\))\\)" (car sender)) (if (match-beginning 3) (list (match-string 1 (car sender)) (match-string 3 (car sender))) (list (match-string 1 (car sender)) (substring (car sender) (match-end 0)))) (list (car sender)))) (case-fold-search t)) (catch 'found (lsdb-maphash (lambda (key value) (while names (if (or (string-match (concat "\\<" (regexp-quote (car names)) "\\>") key) (string-match (concat "\\<" (regexp-quote (mapconcat #'identity (nreverse (split-string (car names))) " ")) "\\>") key) ;; Don't assume that we are using address cache. (member (nth 1 sender) (cdr (assq 'net value)))) (throw 'found key)) (setq names (cdr names)))) lsdb-hash-table)))) ;;;_ : Update Records (defun lsdb-update-record (sender &optional interesting) (let ((old (lsdb-gethash (car sender) lsdb-hash-table)) (new (if (nth 1 sender) (cons (cons 'net (list (nth 1 sender))) interesting) interesting)) merged record full-name) ;; Look for the existing record from the reverse hash table. ;; If it is found, regsiter the current full-name as AKA. (unless old (setq full-name (run-hook-with-args-until-success 'lsdb-lookup-full-name-functions sender)) (when full-name (setq old (lsdb-gethash full-name lsdb-hash-table) new (cons (list 'aka (car sender)) new)) (setcar sender full-name))) (unless old (setq new (cons (cons 'creation-date (format-time-string "%Y-%m-%d")) new))) (setq merged (lsdb-merge-record-entries old new) record (cons (car sender) merged)) (unless (equal merged old) (let ((entry (assq 'last-modified (cdr record))) (last-modified (format-time-string "%Y-%m-%d"))) (if entry (setcdr entry last-modified) (setcdr record (cons (cons 'last-modified last-modified) (cdr record))))) (lsdb-puthash (car record) (cdr record) lsdb-hash-table) (run-hook-with-args 'lsdb-after-update-record-functions record) (setq lsdb-hash-tables-are-dirty t)) record)) (defun lsdb-update-records () (lsdb-maybe-load-hash-tables) (let (senders recipients interesting alist records bodies entry) (save-restriction (std11-narrow-to-header) (setq senders (delq nil (mapcar (lambda (field) (let ((components (lsdb-extract-address-components (cdr field)))) (if components (setcar components (funcall lsdb-decode-field-body-function (car components) (car field)))) components)) (lsdb-fetch-fields lsdb-sender-headers))) recipients (delq nil (mapcar (lambda (field) (let ((components (lsdb-extract-address-components (cdr field)))) (if components (setcar components (funcall lsdb-decode-field-body-function (car components) (car field)))) components)) (lsdb-fetch-fields lsdb-recipients-headers)))) (setq alist lsdb-interesting-header-alist) (while alist (setq bodies (delq nil (mapcar (lambda (field) (let ((field-body (funcall lsdb-decode-field-body-function (cdr field) (car field)))) (if (nth 1 (car alist)) (and (string-match (nth 1 (car alist)) field-body) (replace-match (nth 3 (car alist)) nil nil field-body)) field-body))) (lsdb-fetch-fields (car (car alist)))))) (when bodies (setq entry (or (nth 2 (car alist)) 'notes)) (push (cons entry (if (eq ?. (nth 2 (assq entry lsdb-entry-type-alist))) (car bodies) bodies)) interesting)) (setq alist (cdr alist)))) (if senders (setq records (list (lsdb-update-record (pop senders) interesting)))) (setq alist (nconc senders recipients)) (while alist (setq records (cons (lsdb-update-record (pop alist)) records))) (nreverse records))) (defun lsdb-merge-record-entries (old new) (setq old (copy-sequence old)) (while new (let ((entry (assq (car (car new)) old)) list pointer) (if (null entry) (setq old (nconc old (list (car new)))) (if (listp (cdr entry)) (progn (setq list (cdr (car new)) pointer list) (while pointer (if (member (car pointer) (cdr entry)) (setq list (delq (car pointer) list))) (setq pointer (cdr pointer))) (setcdr entry (nconc (cdr entry) list))) (setcdr entry (cdr (car new)))))) (setq new (cdr new))) old) ;;;_. Display Management (defun lsdb-fit-window-to-buffer (&optional window) (save-selected-window (if window (select-window window)) (unless (pos-visible-in-window-p (point-max)) (enlarge-window (- lsdb-window-max-height (window-height)))) (shrink-window-if-larger-than-buffer) (let ((height (window-height))) (if (> height lsdb-window-max-height) (shrink-window (- height lsdb-window-max-height))) (set-window-start window (point-min))))) (defun lsdb-temp-buffer-show-function (buffer) (when lsdb-pop-up-windows (save-selected-window (let ((window (or (get-buffer-window lsdb-buffer-name) (progn (select-window (get-largest-window)) (split-window-vertically))))) (set-window-buffer window buffer) (lsdb-fit-window-to-buffer window))))) (defun lsdb-update-records-and-display () (let ((records (lsdb-update-records))) (if lsdb-display-records-belong-to-user (if records (lsdb-display-record (car records)) (lsdb-hide-buffer)) (catch 'lsdb-show-record (while records (if (member user-mail-address (cdr (assq 'net (car records)))) (setq records (cdr records)) (lsdb-display-record (car records)) (throw 'lsdb-show-record t))) (lsdb-hide-buffer))))) (defun lsdb-display-record (record) "Display only one RECORD, then shrink the window as possible." (let ((temp-buffer-show-function lsdb-temp-buffer-show-function)) (lsdb-display-records (list record)))) (defun lsdb-display-records (records) (with-current-buffer (get-buffer-create lsdb-buffer-name) (let ((standard-output (current-buffer)) (inhibit-read-only t) buffer-read-only) (buffer-disable-undo) (erase-buffer) (setq records (sort (copy-sequence records) (or lsdb-display-records-sort-predicate (lambda (record1 record2) (string-lessp (car record1) (car record2)))))) (while records (save-restriction (narrow-to-region (point) (point)) (lsdb-print-record (car records))) (goto-char (point-max)) (setq records (cdr records)))) (lsdb-mode) (set-buffer-modified-p lsdb-hash-tables-are-dirty) (goto-char (point-min)) (if temp-buffer-show-function (funcall temp-buffer-show-function (current-buffer)) (pop-to-buffer (current-buffer))))) (defsubst lsdb-entry-score (entry) (or (nth 1 (assq (car entry) lsdb-entry-type-alist)) 0)) (defun lsdb-insert-entry (entry) (let ((entry-name (capitalize (symbol-name (car entry))))) (intern entry-name lsdb-known-entry-names) (if (>= (lsdb-entry-score entry) 0) (insert "\t" entry-name ": " (if (listp (cdr entry)) (mapconcat #'identity (cdr entry) (if (eq ?, (nth 2 (assq (car entry) lsdb-entry-type-alist))) ", " "\n\t\t")) (cdr entry)) "\n")))) (defun lsdb-print-record (record) (insert (car record) "\n") (let ((entries (sort (copy-sequence (cdr record)) (lambda (entry1 entry2) (> (lsdb-entry-score entry1) (lsdb-entry-score entry2)))))) (while entries (lsdb-insert-entry (car entries)) (setq entries (cdr entries)))) (add-text-properties (point-min) (point-max) (list 'lsdb-record record)) (run-hooks 'lsdb-print-record-hook)) ;;;_. Completion (defvar lsdb-last-completion nil) (defvar lsdb-last-candidates nil) (defvar lsdb-last-candidates-pointer nil) (defvar lsdb-complete-marker nil) ;;;_ : Matching Highlight (defvar lsdb-last-highlight-overlay nil) ;;; avoid byte-compile warning for migemo (eval-when-compile (autoload 'migemo-get-pattern "migemo")) (defun lsdb-complete-name-highlight (start end) (make-local-hook 'pre-command-hook) (add-hook 'pre-command-hook 'lsdb-complete-name-highlight-update nil t) (save-excursion (goto-char start) (if (and lsdb-use-migemo (fboundp 'migemo-get-pattern)) (re-search-forward lsdb-last-completion end) (search-forward lsdb-last-completion end)) (setq lsdb-last-highlight-overlay (make-overlay (match-beginning 0) (match-end 0))) (overlay-put lsdb-last-highlight-overlay 'face (or (find-face 'isearch-secondary) (find-face 'isearch-lazy-highlight-face) 'underline)))) (defun lsdb-complete-name-highlight-update () (unless (eq this-command 'lsdb-complete-name) (if lsdb-last-highlight-overlay (delete-overlay lsdb-last-highlight-overlay)) (set-marker lsdb-complete-marker nil) (remove-hook 'pre-command-hook 'lsdb-complete-name-highlight-update t))) ;;;_ : Name Completion (defun lsdb-complete-name () "Complete the user full-name or net-address before point" (interactive) (lsdb-maybe-load-hash-tables) (unless (markerp lsdb-complete-marker) (setq lsdb-complete-marker (make-marker))) (let* ((start (or (and (eq (marker-buffer lsdb-complete-marker) (current-buffer)) (marker-position lsdb-complete-marker)) (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (set-marker lsdb-complete-marker (match-end 0))))) pattern (case-fold-search t) (completion-ignore-case t)) (unless (eq last-command this-command) (setq lsdb-last-candidates nil lsdb-last-candidates-pointer nil lsdb-last-completion (buffer-substring start (point))) (if (and lsdb-use-migemo (fboundp 'migemo-get-pattern)) (setq lsdb-last-completion (migemo-get-pattern lsdb-last-completion) pattern (concat "\\<\\(" lsdb-last-completion "\\)")) (setq pattern (concat "\\<" (regexp-quote lsdb-last-completion)))) (lsdb-maphash (lambda (key value) (setq lsdb-last-candidates (nconc lsdb-last-candidates (delq nil (mapcar (lambda (candidate) (if (string-match pattern candidate) candidate)) (if lsdb-strip-address (cdr (assq 'net value)) (append (cdr (assq 'net value)) (cdr (assq 'sender value))))))))) lsdb-hash-table) ;; Sort candidates by the position where the pattern occurred. (setq lsdb-last-candidates (sort lsdb-last-candidates (lambda (cand1 cand2) (< (if (string-match pattern cand1) (match-beginning 0)) (if (string-match pattern cand2) (match-beginning 0))))))) (unless lsdb-last-candidates-pointer (setq lsdb-last-candidates-pointer lsdb-last-candidates)) (when lsdb-last-candidates-pointer (delete-region start (point)) (insert (pop lsdb-last-candidates-pointer)) (lsdb-complete-name-highlight start (point))))) ;;;_. Major Mode (`lsdb-mode') Implementation ;;;_ : Modeline Buffer Identification (defconst lsdb-pointer-xpm "/* XPM */ static char * lsdb_pointer_xpm[] = { \"14 14 5 1\", \" c None\", \"+ c #FF9696\", \"@ c #FF0000\", \"# c #FF7575\", \"$ c #FF5959\", \" \", \" +++ @@@ \", \" +++## @@@@@ \", \" ++### @@@@@ \", \" +#####@@@@@ \", \" +###$$@@@@@ \", \" +###$$@@@@@ \", \" ##$$$@@@@ \", \" #$$$@@@ \", \" $$@@@ \", \" $@@ \", \" @ \", \" \", \" \"};") (static-if (featurep 'xemacs) (progn (defvar lsdb-xemacs-modeline-left-extent (copy-extent modeline-buffer-id-left-extent)) (defvar lsdb-xemacs-modeline-right-extent (copy-extent modeline-buffer-id-right-extent)) (defun lsdb-modeline-buffer-identification (line) "Decorate 1st element of `mode-line-buffer-identification' LINE. Modify whole identification by side effect." (let ((id (car line)) chopped) (if (and (stringp id) (string-match "^LSDB:" id)) (progn (setq chopped (substring id 0 (match-end 0)) id (substring id (match-end 0))) (nconc (list (let ((glyph (make-glyph (nconc (if (featurep 'xpm) (list (vector 'xpm :data lsdb-pointer-xpm))) (list (vector 'string :data chopped)))))) (set-glyph-face glyph 'modeline-buffer-id) (cons lsdb-xemacs-modeline-left-extent glyph)) (cons lsdb-xemacs-modeline-right-extent id)) (cdr line))) line)))) (condition-case nil (progn (require 'image) (defun lsdb-modeline-buffer-identification (line) "Decorate 1st element of `mode-line-buffer-identification' LINE. Modify whole identification by side effect." (let ((id (copy-sequence (car line))) (image (if (image-type-available-p 'xpm) (create-image lsdb-pointer-xpm 'xpm t :ascent 'center)))) (when (and image (stringp id) (string-match "^LSDB:" id)) (add-text-properties 0 (length id) (list 'display image 'rear-nonsticky (list 'display)) id) (setcar line id)) line))) (error (defalias 'lsdb-modeline-buffer-identification 'identity)))) (defvar lsdb-mode-map (let ((keymap (make-sparse-keymap))) (define-key keymap "a" 'lsdb-mode-add-entry) (define-key keymap "d" 'lsdb-mode-delete-entry) (define-key keymap "D" 'lsdb-mode-delete-record) (define-key keymap "e" 'lsdb-mode-edit-entry) (define-key keymap "E" 'lsdb-mode-edit-record) (define-key keymap "l" 'lsdb-mode-load) (define-key keymap "s" 'lsdb-mode-save) (define-key keymap "q" 'lsdb-mode-quit-window) (define-key keymap "g" 'lsdb-mode-lookup) (define-key keymap "p" 'lsdb-mode-previous-record) (define-key keymap "n" 'lsdb-mode-next-record) (define-key keymap " " 'scroll-up) (define-key keymap [delete] 'scroll-down) (define-key keymap "\177" 'scroll-down) (define-key keymap [backspace] 'scroll-down) keymap) "LSDB's keymap.") (defvar lsdb-modeline-string "") (define-derived-mode lsdb-mode fundamental-mode "LSDB" "Major mode for browsing LSDB records." (setq buffer-read-only t) (static-if (featurep 'xemacs) ;; In XEmacs, setting `font-lock-defaults' only affects on ;; `find-file-hooks'. (font-lock-set-defaults) (set (make-local-variable 'font-lock-defaults) '(lsdb-font-lock-keywords t))) (make-local-hook 'post-command-hook) (add-hook 'post-command-hook 'lsdb-modeline-update nil t) (make-local-variable 'lsdb-modeline-string) (setq mode-line-buffer-identification (lsdb-modeline-buffer-identification '("LSDB: " lsdb-modeline-string))) (lsdb-modeline-update) (force-mode-line-update)) (defun lsdb-modeline-update () (let ((record (get-text-property (if (eobp) (point-min) (point)) 'lsdb-record)) net) (if record (progn (setq net (car (cdr (assq 'net (cdr record))))) (if (and net (equal net (car record))) (setq lsdb-modeline-string net) (setq lsdb-modeline-string (concat (car record) " <" net ">")))) (setq lsdb-modeline-string "")))) (defun lsdb-narrow-to-record () "Narrow to the current record." (let ((end (next-single-property-change (point) 'lsdb-record nil (point-max)))) (narrow-to-region (previous-single-property-change end 'lsdb-record nil (point-min)) end) (goto-char (point-min)))) (defun lsdb-current-record () "Return the current record name." (get-text-property (point) 'lsdb-record)) (defun lsdb-delete-record (record) "Delete given RECORD." (lsdb-remhash (car record) lsdb-hash-table) (run-hook-with-args 'lsdb-after-delete-record-functions record) (setq lsdb-hash-tables-are-dirty t)) (defun lsdb-current-entry () "Return the current entry name in canonical form." (save-excursion (beginning-of-line) (if (looking-at "^\t\\([^\t][^:]+\\):") (intern (downcase (match-string 1)))))) (defun lsdb-read-entry (record &optional prompt) "Prompt to select an entry in the given RECORD." (let* ((completion-ignore-case t) (entry-name (completing-read (or prompt "Which entry: ") (mapcar (lambda (entry) (list (capitalize (symbol-name (car entry))))) (cdr record)) nil t))) (unless (equal entry-name "") (intern (downcase entry-name))))) (defun lsdb-delete-entry (record entry) "Delete given ENTRY from RECORD." (setcdr record (delq entry (cdr record))) (lsdb-puthash (car record) (cdr record) lsdb-hash-table) (run-hook-with-args 'lsdb-after-update-record-functions record) (setq lsdb-hash-tables-are-dirty t)) (defun lsdb-mode-add-entry (entry-name) "Add an entry on the current line." (interactive (let ((completion-ignore-case t)) (list (completing-read "Entry name: " lsdb-known-entry-names)))) (beginning-of-line) (unless (symbolp entry-name) (setq entry-name (intern (downcase entry-name)))) (when (assq entry-name (cdr (lsdb-current-record))) (error "The entry already exists")) (let ((marker (point-marker))) (lsdb-edit-form nil "Editing the entry." `(lambda (form) (when form (save-excursion (set-buffer lsdb-buffer-name) (goto-char ,marker) (let ((record (lsdb-current-record)) (inhibit-read-only t) buffer-read-only) (setcdr record (cons (cons ',entry-name form) (cdr record))) (lsdb-puthash (car record) (cdr record) lsdb-hash-table) (run-hook-with-args 'lsdb-after-update-record-functions record) (setq lsdb-hash-tables-are-dirty t) (beginning-of-line 2) (add-text-properties (point) (progn (lsdb-insert-entry (cons ',entry-name form)) (point)) (list 'lsdb-record record))))))))) (defun lsdb-mode-delete-entry-1 (entry) "Delete text contents of the ENTRY from the current buffer." (save-restriction (lsdb-narrow-to-record) (let ((case-fold-search t) (inhibit-read-only t) buffer-read-only) (goto-char (point-min)) (if (re-search-forward (concat "^\t" (capitalize (symbol-name (car entry))) ":") nil t) (delete-region (match-beginning 0) (if (re-search-forward "^\t[^\t][^:]+:" nil t) (match-beginning 0) (point-max))))))) (defun lsdb-mode-delete-entry () "Delete the entry on the current line." (interactive) (let ((record (lsdb-current-record)) entry-name entry) (unless record (error "There is nothing to follow here")) (setq entry-name (or (lsdb-current-entry) (lsdb-read-entry record "Which entry to delete: ")) entry (assq entry-name (cdr record))) (when (and entry (or (not lsdb-verbose) (y-or-n-p (format "Do you really want to delete entry `%s' of `%s'? " entry-name (car record))))) (lsdb-delete-entry record entry) (lsdb-mode-delete-entry-1 entry)))) (defun lsdb-mode-delete-record () "Delete the record on the current line." (interactive) (let ((record (lsdb-current-record))) (unless record (error "%s" "There is nothing to follow here")) (when (or (not lsdb-verbose) (yes-or-no-p (format "Do you really want to delete entire record of `%s'? " (car record)))) (lsdb-delete-record record) (save-restriction (lsdb-narrow-to-record) (let ((inhibit-read-only t) buffer-read-only) (delete-region (point-min) (point-max))))))) (defun lsdb-mode-delete-entry-or-record () "Delete the entry on the current line. If the cursor is on the first line of a database entry (the name line) then the entire entry will be deleted." (interactive) (if (lsdb-current-entry) (lsdb-mode-delete-entry) (lsdb-mode-delete-record))) (defun lsdb-mode-edit-entry () "Edit the entry on the current line." (interactive) (let ((record (lsdb-current-record))) (unless record (error "There is nothing to follow here")) (let ((entry-name (or (lsdb-current-entry) (lsdb-read-entry record "Which entry to edit: ")))) (lsdb-edit-form (cdr (assq entry-name (cdr record))) "Editing the entry." `(lambda (form) (let* ((record ',record) (entry-name ',entry-name) (entry (assq entry-name (cdr record)))) (unless (equal form (cdr entry)) (setcdr entry form) (run-hook-with-args 'lsdb-after-update-record-functions record) (setq lsdb-hash-tables-are-dirty t) (with-current-buffer lsdb-buffer-name (let ((inhibit-read-only t) buffer-read-only (pos (text-property-any (point-min) (point-max) 'lsdb-record record))) (unless pos (error "%s" "The entry currently in editing is discarded")) (lsdb-mode-delete-entry-1 entry) (forward-line 0) (add-text-properties (point) (progn (lsdb-insert-entry (cons entry-name form)) (point)) (list 'lsdb-record record))))))))))) (defun lsdb-mode-edit-record () "Edit the name of the record on the current line." (interactive) (let ((record (lsdb-current-record))) (unless record (error "There is nothing to follow here")) (lsdb-edit-form (car record) "Editing the name." `(lambda (new-name) (unless (stringp new-name) (error "String is required: `%s'" new-name)) (let* ((record ',record) (old-name (car record))) (unless (equal new-name old-name) (lsdb-delete-record record) (setcar record new-name) (lsdb-puthash new-name (cdr record) lsdb-hash-table) (run-hook-with-args 'lsdb-after-update-record-functions record) (setq lsdb-hash-tables-are-dirty t) (with-current-buffer lsdb-buffer-name (let ((inhibit-read-only t) buffer-read-only (pos (text-property-any (point-min) (point-max) 'lsdb-record record))) (unless pos (error "%s" "The entry currently in editing is discarded")) (delete-region (point) (+ (point) (length old-name))) (add-text-properties (point) (progn (insert form) (point)) (list 'lsdb-record record)))))))))) (defun lsdb-mode-edit-entry-or-record () "Edit the entry on the current line. If the cursor is on the first line of a database entry (the name line) then the name of this record will be edited." (interactive) (if (lsdb-current-entry) (lsdb-mode-edit-entry) (lsdb-mode-edit-record))) (defun lsdb-mode-save (&optional dont-ask) "Save LSDB hash table into `lsdb-file'." (interactive (list t)) (if (not lsdb-hash-tables-are-dirty) (message "(No changes need to be saved)") (when (or dont-ask (not lsdb-verbose) (y-or-n-p "Save the LSDB now? ")) (lsdb-save-hash-tables) (set-buffer-modified-p (setq lsdb-hash-tables-are-dirty nil)) (message "The LSDB was saved successfully.")))) (defun lsdb-mode-load () "Load LSDB hash table from `lsdb-file'." (interactive) (let (lsdb-secondary-hash-tables) (lsdb-load-hash-tables)) (message "Rebuilding secondary hash tables...") (lsdb-rebuild-secondary-hash-tables t) (message "Rebuilding secondary hash tables...done")) (defun lsdb-mode-quit-window (&optional kill window) "Quit the current buffer. It partially emulates the GNU Emacs' of `quit-window'." (interactive "P") (unless window (setq window (selected-window))) (let ((buffer (window-buffer window))) (unless (save-selected-window (select-window window) (one-window-p)) (delete-window window)) (if kill (kill-buffer buffer) (bury-buffer (unless (eq buffer (current-buffer)) buffer))))) (defun lsdb-hide-buffer () "Hide the LSDB window." (let ((window (get-buffer-window lsdb-buffer-name))) (if window (lsdb-mode-quit-window nil window)))) (defun lsdb-show-buffer () "Show the LSDB window." (if (get-buffer lsdb-buffer-name) (if lsdb-temp-buffer-show-function (let ((lsdb-pop-up-windows t)) (funcall lsdb-temp-buffer-show-function lsdb-buffer-name)) (pop-to-buffer lsdb-buffer-name)))) (defun lsdb-toggle-buffer (&optional arg) "Toggle hiding of the LSDB window. If given a negative prefix, always show; if given a positive prefix, always hide." (interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 0))) (unless arg ;called noninteractively? (setq arg 0)) (cond ((or (< arg 0) (and (zerop arg) (not (get-buffer-window lsdb-buffer-name)))) (lsdb-show-buffer)) ((or (> arg 0) (and (zerop arg) (get-buffer-window lsdb-buffer-name))) (lsdb-hide-buffer)))) (defun lsdb-lookup-records (regexp &optional entry-name) "Return the all records in the LSDB matching the REGEXP. If the optional 2nd argument ENTRY-NAME is given, matching only performed against the entry field." (let (records) (lsdb-maphash (if entry-name (progn (lambda (key value) (let ((entry (cdr (assq entry-name value))) found) (unless (listp entry) (setq entry (list entry))) (while (and (not found) entry) (if (string-match regexp (pop entry)) (setq found t))) (if found (push (cons key value) records))))) (lambda (key value) (if (string-match regexp key) (push (cons key value) records)))) lsdb-hash-table) records)) (defvar lsdb-mode-lookup-history nil) (defun lsdb-mode-lookup (regexp &optional entry-name) "Display the all records in the LSDB matching the REGEXP. If the optional 2nd argument ENTRY-NAME is given, matching only performed against the entry field." (interactive (let* ((completion-ignore-case t) (entry-name (if current-prefix-arg (completing-read "Entry name: " lsdb-known-entry-names)))) (list (read-from-minibuffer (if entry-name (format "Search records `%s' regexp: " entry-name) "Search records regexp: ") nil nil nil 'lsdb-mode-lookup-history) (if (and entry-name (not (equal entry-name ""))) (intern (downcase entry-name)))))) (lsdb-maybe-load-hash-tables) (let ((records (lsdb-lookup-records regexp entry-name))) (if records (lsdb-display-records records)))) ;;;###autoload (defalias 'lsdb 'lsdb-mode-lookup) (defun lsdb-mode-next-record (&optional arg) "Go to the next record." (interactive "p") (unless arg ;called noninteractively? (setq arg 1)) (if (< arg 0) (lsdb-mode-previous-record (- arg)) (while (> arg 0) (goto-char (next-single-property-change (point) 'lsdb-record nil (point-max))) (setq arg (1- arg))))) (defun lsdb-mode-previous-record (&optional arg) "Go to the previous record." (interactive "p") (unless arg ;called noninteractively? (setq arg 1)) (if (< arg 0) (lsdb-mode-next-record (- arg)) (while (> arg 0) (goto-char (previous-single-property-change (point) 'lsdb-record nil (point-min))) (setq arg (1- arg))))) ;;;_ : Edit Forms -- stolen (and renamed) from gnus-eform.el (defvar lsdb-edit-form-buffer "*LSDB edit form*") (defvar lsdb-edit-form-done-function nil) (defvar lsdb-previous-window-configuration nil) (defvar lsdb-edit-form-mode-map (let ((keymap (make-sparse-keymap))) (set-keymap-parent keymap emacs-lisp-mode-map) (define-key keymap "\C-c\C-c" 'lsdb-edit-form-done) (define-key keymap "\C-c\C-k" 'lsdb-edit-form-exit) keymap) "Edit form's keymap.") (defun lsdb-edit-form-mode () "Major mode for editing forms. It is a slightly enhanced emacs-lisp-mode. \\{lsdb-edit-form-mode-map}" (interactive) (kill-all-local-variables) (setq major-mode 'lsdb-edit-form-mode mode-name "LSDB Edit Form") (use-local-map lsdb-edit-form-mode-map) (make-local-variable 'lsdb-edit-form-done-function) (make-local-variable 'lsdb-previous-window-configuration) (run-hooks 'lsdb-edit-form-mode-hook)) (defun lsdb-edit-form (form documentation exit-func) "Edit FORM in a new buffer. Call EXIT-FUNC on exit. Display DOCUMENTATION in the beginning of the buffer." (let ((window-configuration (current-window-configuration))) (switch-to-buffer (get-buffer-create lsdb-edit-form-buffer)) (lsdb-edit-form-mode) (setq lsdb-previous-window-configuration window-configuration lsdb-edit-form-done-function exit-func) (erase-buffer) (insert documentation) (unless (bolp) (insert "\n")) (goto-char (point-min)) (while (not (eobp)) (insert ";;; ") (forward-line 1)) (insert ";; Type `C-c C-c' after you've finished editing.\n") (insert "\n") (let ((p (point))) (pp form (current-buffer)) (insert "\n") (goto-char p)))) (defun lsdb-edit-form-done () "Update changes and kill the current buffer." (interactive) (goto-char (point-min)) (let ((form (condition-case nil (read (current-buffer)) (end-of-file nil))) (func lsdb-edit-form-done-function)) (lsdb-edit-form-exit) (funcall func form))) (defun lsdb-edit-form-exit () "Kill the current buffer." (interactive) (let ((window-configuration lsdb-previous-window-configuration)) (kill-buffer (current-buffer)) (set-window-configuration window-configuration))) ;;;_. Interface to Semi-gnus ;;;###autoload (defun lsdb-gnus-insinuate () "Call this function to hook LSDB into Semi-gnus." (add-hook 'gnus-article-prepare-hook 'lsdb-gnus-update-record) (add-hook 'gnus-save-newsrc-hook 'lsdb-mode-save)) (defvar gnus-article-current-summary) (defvar gnus-original-article-buffer) (defun lsdb-gnus-update-record () (with-current-buffer (with-current-buffer gnus-article-current-summary gnus-original-article-buffer) (lsdb-update-records-and-display))) ;;;_. Interface to Wanderlust ;;;###autoload (defun lsdb-wl-insinuate () "Call this function to hook LSDB into Wanderlust." (add-hook 'wl-message-redisplay-hook 'lsdb-wl-update-record) (add-hook 'wl-summary-exit-hook 'lsdb-hide-buffer) (add-hook 'wl-summary-toggle-disp-off-hook 'lsdb-hide-buffer) (add-hook 'wl-summary-toggle-disp-folder-on-hook 'lsdb-hide-buffer) (add-hook 'wl-summary-toggle-disp-folder-off-hook 'lsdb-hide-buffer) (add-hook 'wl-summary-toggle-disp-folder-message-resumed-hook 'lsdb-wl-show-buffer) (add-hook 'wl-exit-hook 'lsdb-mode-save) (add-hook 'wl-save-hook 'lsdb-mode-save)) (eval-when-compile (autoload 'wl-message-get-original-buffer "wl-message")) (defun lsdb-wl-update-record () (save-excursion (set-buffer (wl-message-get-original-buffer)) (let ((lsdb-temp-buffer-show-function #'lsdb-wl-temp-buffer-show-function)) (lsdb-update-records-and-display)))) (defun lsdb-wl-toggle-buffer (&optional arg) "Toggle hiding of the LSDB window for Wanderlust. If given a negative prefix, always show; if given a positive prefix, always hide." (interactive (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 0))) (let ((lsdb-temp-buffer-show-function #'lsdb-wl-temp-buffer-show-function)) (lsdb-toggle-buffer arg))) (defun lsdb-wl-show-buffer () (when lsdb-pop-up-windows (let ((lsdb-temp-buffer-show-function #'lsdb-wl-temp-buffer-show-function)) (lsdb-show-buffer)))) (defvar wl-current-summary-buffer) (defvar wl-message-buffer) (defun lsdb-wl-temp-buffer-show-function (buffer) (when lsdb-pop-up-windows (save-selected-window (let ((window (or (get-buffer-window lsdb-buffer-name) (progn (select-window (or (save-excursion (if (buffer-live-p wl-current-summary-buffer) (set-buffer wl-current-summary-buffer)) (get-buffer-window wl-message-buffer)) (get-largest-window))) (split-window-vertically))))) (set-window-buffer window buffer) (lsdb-fit-window-to-buffer window))))) ;;;_. Interface to Mew written by Hideyuki SHIRAI (eval-when-compile (condition-case nil (progn (require 'mew) ;; Avoid macro `mew-cache-hit' expand (Mew 1.94.2 or earlier). ;; Changed `mew-cache-hit' from macro to function at Mew 2.0. (if (not (fboundp 'mew-current-get-fld)) (setq byte-compile-macro-environment (cons '(mew-cache-hit . nil) byte-compile-macro-environment)))) (error ;; Silence byte compiler for environments where Mew does not installed. (autoload 'mew-sinfo-get-disp-msg "mew") (autoload 'mew-current-get-fld "mew") (autoload 'mew-current-get-msg "mew") (autoload 'mew-frame-id "mew") (autoload 'mew-cache-hit "mew") (autoload 'mew-xinfo-get-decode-err "mew") (autoload 'mew-xinfo-get-action "mew")))) ;;;###autoload (defun lsdb-mew-insinuate () "Call this function to hook LSDB into Mew." (add-hook 'mew-message-hook 'lsdb-mew-update-record) (add-hook 'mew-summary-toggle-disp-msg-hook (lambda () (unless (mew-sinfo-get-disp-msg) (lsdb-hide-buffer)))) (add-hook 'mew-suspend-hook 'lsdb-hide-buffer) (add-hook 'mew-quit-hook 'lsdb-mode-save) (add-hook 'kill-emacs-hook 'lsdb-mode-save) (cond ;; Mew 3 ((fboundp 'mew-summary-visit-folder) (defadvice mew-summary-visit-folder (before lsdb-hide-buffer activate) (lsdb-hide-buffer))) ;; Mew 2 ((fboundp 'mew-summary-switch-to-folder) (defadvice mew-summary-switch-to-folder (before lsdb-hide-buffer activate) (lsdb-hide-buffer))))) (defun lsdb-mew-update-record () (let* ((fld (mew-current-get-fld (mew-frame-id))) (msg (mew-current-get-msg (mew-frame-id))) (cache (mew-cache-hit fld msg))) (when cache (save-excursion (set-buffer cache) (unless (or (mew-xinfo-get-decode-err) (mew-xinfo-get-action)) (make-local-variable 'lsdb-decode-field-body-function) (setq lsdb-decode-field-body-function (lambda (body name) (set-text-properties 0 (length body) nil body) body)) (lsdb-update-records-and-display)))))) ;;;_. Interface to MU-CITE (eval-when-compile (autoload 'mu-cite-get-value "mu-cite")) (defun lsdb-mu-attribution (address) "Extract attribute information from LSDB." (let ((records (lsdb-lookup-records (concat "\\<" address "\\>") 'net))) (if records (cdr (assq 'attribution (cdr (car records))))))) (defun lsdb-mu-set-attribution (attribution address) "Add attribute information to LSDB." (let ((records (lsdb-lookup-records (concat "\\<" address "\\>") 'net)) entry) (when records (setq entry (assq 'attribution (cdr (car records)))) (if entry (setcdr entry attribution) (setcdr (car records) (cons (cons 'attribution attribution) (cdr (car records)))) (lsdb-puthash (car (car records)) (cdr (car records)) lsdb-hash-table) (run-hook-with-args 'lsdb-after-update-record-functions (car records)) (setq lsdb-hash-tables-are-dirty t))))) (defun lsdb-mu-get-prefix-method () "A mu-cite method to return a prefix from LSDB or \">\". If an `attribution' value is found in LSDB, the value is returned. Otherwise \">\" is returned." (or (lsdb-mu-attribution (mu-cite-get-value 'address)) ">")) (defvar minibuffer-allow-text-properties) (defvar lsdb-mu-history nil) (defun lsdb-mu-get-prefix-register-method () "A mu-cite method to return a prefix from LSDB or register it. If an `attribution' value is found in LSDB, the value is returned. Otherwise the function requests a prefix from a user. The prefix will be registered to LSDB if the user wants it." (let ((address (mu-cite-get-value 'address))) (or (lsdb-mu-attribution address) (let* (minibuffer-allow-text-properties (result (read-string "Citation name? " (or (mu-cite-get-value 'x-attribution) (mu-cite-get-value 'full-name)) 'lsdb-mu-history))) (if (and (not (string-equal result "")) (y-or-n-p (format "Register \"%s\"? " result))) (lsdb-mu-set-attribution result address)) result)))) (defun lsdb-mu-get-prefix-register-verbose-method () "A mu-cite method to return a prefix using LSDB. In this method, a user must specify a prefix unconditionally. If an `attribution' value is found in LSDB, the value is used as a initial value to input the prefix. The prefix will be registered to LSDB if the user wants it." (let* ((address (mu-cite-get-value 'address)) (attribution (lsdb-mu-attribution address)) minibuffer-allow-text-properties (result (read-string "Citation name? " (or attribution (mu-cite-get-value 'x-attribution) (mu-cite-get-value 'full-name)) 'lsdb-mu-history))) (if (and (not (string-equal result "")) (not (string-equal result attribution)) (y-or-n-p (format "Register \"%s\"? " result))) (lsdb-mu-set-attribution result address)) result)) (defvar mu-cite-methods-alist) ;;;###autoload (defun lsdb-mu-insinuate () (add-hook 'mu-cite-instantiation-hook (lambda () (setq mu-cite-methods-alist (nconc mu-cite-methods-alist (list (cons 'lsdb-prefix #'lsdb-mu-get-prefix-method) (cons 'lsdb-prefix-register #'lsdb-mu-get-prefix-register-method) (cons 'lsdb-prefix-register-verbose #'lsdb-mu-get-prefix-register-verbose-method))))))) ;;;_. X-Face Rendering (defvar lsdb-x-face-cache (lsdb-make-hash-table :test 'equal)) (defun lsdb-x-face-available-image-type () (static-if (featurep 'xemacs) (if (featurep 'xpm) 'xpm) (and (>= emacs-major-version 21) (fboundp 'image-type-available-p) (if (image-type-available-p 'pbm) 'pbm (if (image-type-available-p 'xpm) 'xpm))))) (defun lsdb-expose-x-face () (let* ((record (get-text-property (point-min) 'lsdb-record)) (x-face (cdr (assq 'x-face (cdr record)))) (delimiter "\r ")) (when (and lsdb-insert-x-face-function x-face) (goto-char (point-min)) (end-of-line) (put-text-property 0 1 'invisible t delimiter) ;hide "\r" (put-text-property (point) (progn (insert delimiter) (while x-face (funcall lsdb-insert-x-face-function (pop x-face))) (point)) 'lsdb-record record)))) (defun lsdb-insert-x-face-image (data type marker) (static-if (featurep 'xemacs) (save-excursion (set-buffer (marker-buffer marker)) (goto-char marker) (let* ((inhibit-read-only t) buffer-read-only (glyph (make-glyph (vector type :data data)))) (set-extent-begin-glyph (make-extent (point) (point)) glyph))) (save-excursion (set-buffer (marker-buffer marker)) (goto-char marker) (let* ((inhibit-read-only t) buffer-read-only (image (create-image data type t :ascent 'center)) (record (get-text-property (point) 'lsdb-record))) (put-text-property (point) (progn (insert-image image) (point)) 'lsdb-record record))))) (defun lsdb-insert-x-face-asynchronously (x-face) (let* ((type (or lsdb-x-face-image-type (lsdb-x-face-available-image-type))) (shell-file-name lsdb-shell-file-name) (shell-command-switch lsdb-shell-command-switch) (coding-system-for-read 'binary) (process-connection-type nil) (cached (cdr (assq type (lsdb-gethash x-face lsdb-x-face-cache)))) (marker (point-marker)) process) (if cached (lsdb-insert-x-face-image cached type marker) (setq process (start-process-shell-command "lsdb-x-face-command" (generate-new-buffer " *lsdb work*") (concat "{ " (nth 1 (assq type lsdb-x-face-command-alist)) "; } 2> /dev/null"))) (process-send-string process (concat x-face "\n")) (process-send-eof process) (set-process-sentinel process `(lambda (process string) (unwind-protect (when (and (buffer-live-p (marker-buffer ,marker)) (equal string "finished\n")) (let ((data (with-current-buffer (process-buffer process) (set-buffer-multibyte nil) (buffer-string)))) (lsdb-insert-x-face-image data ',type ,marker) (lsdb-puthash ,x-face (list (cons ',type data)) lsdb-x-face-cache))) (kill-buffer (process-buffer process)))))))) ;;;_. Face Rendering (defvar lsdb-face-cache (lsdb-make-hash-table :test 'equal)) (defun lsdb-face-available-image-type () (static-if (featurep 'xemacs) (if (featurep 'png) 'png (if (featurep 'xpm) 'xpm)) (and (>= emacs-major-version 21) (fboundp 'image-type-available-p) (if (image-type-available-p 'png) 'png (if (image-type-available-p 'xpm) 'xpm))))) (defun lsdb-expose-face () (let* ((record (get-text-property (point-min) 'lsdb-record)) (face (cdr (assq 'face (cdr record)))) (delimiter "\r ")) (when (and lsdb-insert-face-function face) (goto-char (point-min)) (end-of-line) (put-text-property 0 1 'invisible t delimiter) ;hide "\r" (put-text-property (point) (progn (insert delimiter) (while face (funcall lsdb-insert-face-function (pop face))) (point)) 'lsdb-record record)))) (defun lsdb-insert-face-image (data type marker) (static-if (featurep 'xemacs) (save-excursion (set-buffer (marker-buffer marker)) (goto-char marker) (let* ((inhibit-read-only t) buffer-read-only (glyph (make-glyph (vector type :data data)))) (set-extent-begin-glyph (make-extent (point) (point)) glyph))) (save-excursion (set-buffer (marker-buffer marker)) (goto-char marker) (let* ((inhibit-read-only t) buffer-read-only (image (create-image data type t :ascent 'center)) (record (get-text-property (point) 'lsdb-record))) (put-text-property (point) (progn (insert-image image) (point)) 'lsdb-record record))))) (defun lsdb-insert-face-asynchronously (face) (let* ((type (or lsdb-face-image-type (lsdb-face-available-image-type))) (shell-file-name lsdb-shell-file-name) (shell-command-switch lsdb-shell-command-switch) (coding-system-for-read 'binary) (coding-system-for-write 'binary) (process-connection-type nil) (cached (cdr (assq type (lsdb-gethash face lsdb-face-cache)))) (marker (point-marker)) process) (if cached (lsdb-insert-face-image cached type marker) (setq process (start-process-shell-command "lsdb-face-command" (generate-new-buffer " *lsdb work*") (concat "{ " (nth 1 (assq type lsdb-face-command-alist)) "; } 2> /dev/null"))) (process-send-string process (base64-decode-string face)) (process-send-eof process) (set-process-sentinel process `(lambda (process string) (unwind-protect (when (and (buffer-live-p (marker-buffer ,marker)) (equal string "finished\n")) (let ((data (with-current-buffer (process-buffer process) (set-buffer-multibyte nil) (buffer-string)))) (lsdb-insert-face-image data ',type ,marker) (lsdb-puthash ,face (list (cons ',type data)) lsdb-face-cache))) (kill-buffer (process-buffer process)))))))) (require 'product) (provide 'lsdb) (product-provide 'lsdb (product-define "LSDB" nil '(0 11))) ;;;_* Local emacs vars. ;;; The following `allout-layout' local variable setting: ;;; - closes all topics from the first topic to just before the third-to-last, ;;; - shows the children of the third to last (config vars) ;;; - and the second to last (code section), ;;; - and closes the last topic (this local-variables section). ;;;Local variables: ;;;allout-layout: (0 : -1 -1 0) ;;;End: ;;; lsdb.el ends here lsdb-0.11/ChangeLog0100644000175000017500000005546607777134221012662 0ustar uenoueno2004-01-08 Daiki Ueno * lsdb.el: Increment the version number. 2004-01-08 Daiki Ueno * lsdb.el (lsdb-fetch-fields): New function. (lsdb-fetch-field-bodies): Abolish. (lsdb-update-records): Decode field-bodies here. 2004-01-05 Daiki Ueno * cvs2cl/fmtlog.rb: Suppress warning: "regex literal in condition" (for Ruby 1.8). 2004-01-05 Daiki Ueno * lsdb.el (lsdb-interesting-header-alist): Add setting for Face: header. (lsdb-entry-type-alist): Add setting for 'face entry. (lsdb-face-image-type): New user option. (lsdb-face-command-alist): New user option. (lsdb-insert-face-function): New user option. (lsdb-print-record-hook): Add setting for lsdb-expose-face. (lsdb-update-record): Don't modify 'net entry if canonical address is not specified. (lsdb-face-cache): New variable. (lsdb-face-available-image-type): New function. (lsdb-expose-face): New function. (lsdb-insert-face-image): New function. (lsdb-insert-face-asynchronously): New function. 2004-01-02 Daiki Ueno * README: Fixed. 2004-01-02 Daiki Ueno * README: Fixed. 2003-04-18 Daiki Ueno * lsdb.el: Revert handling Date: field. 2003-04-08 Daiki Ueno * Makefile (ChangeLog): Ignore .tdldb changes. 2003-03-31 Hideyuki SHIRAI * lsdb.el (lsdb-use-migemo): New user option. (lsdb-complete-name-highlight): Use `re-search-forward' insted of `search-forward' if can use migemo. (lsdb-complete-name): Set pattern use migemo if can use migemo. 2003-03-29 Daiki Ueno * lsdb.el: Require 'timezone. (lsdb-entry-type-alist): Add setting for 'last-date. (lsdb-after-update-record-functions): Rename from lsdb-update-record-functions. (lsdb-after-delete-record-functions): Rename from lsdb-delete-record-functions. (lsdb-strip-address): New user option. (lsdb-update-records-and-display): Move belong-to-user logic to lsdb-display-record. (lsdb-gnus-update-record): If an article's Date: field is older than 'last-date, don't attempt to collect information from the article. 2003-03-21 Daiki Ueno * README: Update for allout-html.el. 2003-03-21 Daiki Ueno * lsdb.el: s/outline-/allout-/g. (lsdb-rebuild-secondary-hash-tables): Call lsdb-update-record-functions at most once. (lsdb-interesting-header-alist): Add setting for 'sender. (lsdb-entry-type-alist): Ditto. (lsdb-complete-name): Collect names from 'sender fields instead of regenerating them. (lsdb-save-hash-tables): Add `mode:' cookie. Suggested by Masayuki FUKUI . 2002-10-02 Hideyuki SHIRAI * lsdb.el (lsdb-insert-x-face-asynchronously): Bind process output coding-system to `binary' for the binary PBM image. 2002-10-02 Yoichi NAKAYAMA * lsdb.el: Fix example setting for Wanderlust. 2002-10-02 TSUCHIYA Masatoshi * lsdb.el (lsdb-mode-delete-record): Fix the last change. 2002-10-02 TSUCHIYA Masatoshi * lsdb.el: Add features to remove records and to edit records. (lsdb-delete-record-functions): New option. (lsdb-delete-address-cache): New function. (lsdb-display-records): Use `with-current-buffer' instead of `with-output-to-temp-buffer' to set buffer modification flag. (lsdb-mode-map): Add bindings for `lsdb-mode-delete-record' and `lsdb-mode-edit-record'. (lsdb-delete-record): New function. (lsdb-mode-delete-entry): Do not call `interactive-p'. (lsdb-mode-delete-record, lsdb-mode-delete-entry-or-record): New command. (lsdb-mode-edit-entry): Clean up. (lsdb-mode-edit-record, lsdb-mode-edit-entry-or-record): New command. (lsdb-mode-save): Do not call `interactive-p'; Reset buffer modification flag. 2002-09-29 TSUCHIYA Masatoshi * lsdb.el (lsdb-display-records-belong-to-user): New option. (lsdb-update-records-and-display): New function. (gnus-current-headers): Unbinded. (gnus-article-current-summary): Binded in order to avoid byte compile warning. (gnus-original-article-buffer): Ditto. (lsdb-gnus-update-record): Make it work with Oort Gnus. (lsdb-wl-update-record): Call `lsdb-update-records-and-display'. (lsdb-mew-update-record): Ditto. 2002-09-29 TSUCHIYA Masatoshi * cvs2cl/usermap: Add tsuchiya. 2002-09-13 Hideyuki SHIRAI * README, lsdb.el: Modify keybind for `lsdb-toggle-buffer'. 2002-09-04 Daiki Ueno * lsdb.el: LSDB 0.9. 2002-08-27 Daiki Ueno * lsdb.el: Fix the last change. 2002-08-27 Daiki Ueno * lsdb.el: Added workaround for Mew 1.94.2. Based on the patch from TAKAHASHI Kaoru . 2002-08-27 Daiki Ueno * Makefile (ChangeLog): Add dependencies. 2002-08-25 Daiki Ueno * lsdb.el (lsdb-read) [Emacs]: Don't create temp buffer. 2002-08-25 Daiki Ueno * lsdb.el (lsdb-read) [Emacs]: Don't copy the entire contents of original buffer. 2002-08-25 Daiki Ueno * lsdb.el (lsdb-mode-delete-entry): Fix the last change. 2002-08-25 Daiki Ueno * lsdb.el (lsdb-mode-delete-entry-1): New function. (lsdb-mode-delete-entry): Use it. (lsdb-mode-edit-entry): Ditto. (lsdb-mode-save): Respect lsdb-verbose. 2002-08-25 Daiki Ueno * lsdb.el (lsdb-verbose): New user option. (lsdb-delete-entry): New function. (lsdb-mode-add-entry): Use it. 2002-08-24 Daiki Ueno * lsdb.el (lsdb-insert-hash-table): Bind print-level and print-length. 2002-08-24 Daiki Ueno * lsdb.el (lsdb-modeline-update): Exclude the case 'net is nil. (lsdb-current-record): Simplified. (lsdb-current-entry): Simplified. Don't ask user to select an entry name. (lsdb-read-entry): New function. (lsdb-mode-add-entry): Follow the changes of lsdb-current-record and lsdb-current-entry. (lsdb-mode-delete-entry): Likewise. (lsdb-mode-edit-entry): Likewise. (lsdb-lookup-records): Don't take into account the case that entry-name is a string. (lsdb-mode-lookup): Canonicalize entry-name before calling lsdb-lookup-records. 2002-08-08 OHASHI Akira * lsdb.el: Hack for non-optimize. 2002-07-08 Daiki Ueno * lsdb.el (lsdb-file-coding-system): Default to 'ctext. 2002-05-13 OHASHI Akira * cvs2cl/usermap: Add my name & email address. 2002-05-11 Hideyuki SHIRAI * cvs2cl/usermap: Add my name & email address. 2002-05-11 OHASHI Akira * lsdb.el (lsdb-mode-save): Fix `y-or-n-p' prompt. 2002-05-10 Hideyuki SHIRAI * lsdb.el (lsdb-complete-name): Set start point on `lsdb-complete-marker'. (comment): Change my email address. 2002-05-10 Hideyuki SHIRAI * README (Auhthors): Change my email address. (Mew): Modify keybind for `lsdb-toggle-buffer'. 2002-05-08 Daiki Ueno * lsdb.el: Increment the version number. 2002-05-08 Daiki Ueno * lsdb.el (lsdb-x-face-image-type): New user option. (lsdb-insert-x-face-asynchronously): Respect lsdb-x-face-image-type. (lsdb-mode-quit-window): Don't pass an argument to bury-buffer when we are already on the selected-window. (lsdb-mew-insinuate): Advise mew-summary-visit-folder and mew-summary-switch-to-folder to hide *LSDB* buffer. (lsdb-mew-update-record): Rewrite. Autoload mew-xinfo-get-decode-err and mew-xinfo-get-action when compiling. From Hideyuki SHIRAI 2002-05-08 Daiki Ueno * lsdb.el: Comment was modified to bind "l" instead of ":" for lsdb-toggle-buffer. (lsdb-complete-marker): New variable. (lsdb-complete-name-highlight-update): Reset lsdb-complete-marker; Don't quote 'this-command (possibly a typo) (lsdb-complete-name): Use lsdb-complete-marker to indicate the last position of completion. (lsdb-narrow-to-record): Fixed. From Hideyuki SHIRAI 2002-05-07 Daiki Ueno * lsdb.el: Increment the version number. 2002-05-07 Daiki Ueno * lsdb.el (lsdb-rebuild-secondary-hash-tables): Rename from lsdb-load-secondary-hash-tables. (lsdb-mode-map): Bind "l" to lsdb-mode-load. (lsdb-mode-load): New command. * cvs2cl/fmtlog.rb: Simplified. 2002-05-07 Daiki Ueno * Makefile (distclean): New rule. * cvs2cl/fmtlog.rb: Eliminate the first colon from "* Makefile: (...): ". 2002-05-07 Daiki Ueno * Makefile (ChangeLog): Remove dependencies. 2002-05-07 Daiki Ueno * cvs2cl/fmtlog.rb: Fixed. 2002-05-07 Daiki Ueno * Makefile (ChangeLog): New rule. * cvs2cl/fmtlog.rb: New file. * cvs2cl/usermap: New file. 2002-05-07 Daiki Ueno * README: Comment the setting for message-setup-hook. 2002-05-05 Yoichi NAKAYAMA * README: Fix typo, etc. 2002-05-02 Daiki Ueno * lsdb.el (lsdb-extract-address-components): Ignore empty address string. 2002-05-02 Daiki Ueno * lsdb.el (lsdb-wl-show-buffer): New function which respects lsdb-pop-up-windows. (lsdb-wl-toggle-buffer): New function. From Yuuichi Teranishi * README: Fix setting example. 2002-05-02 Daiki Ueno * lsdb.el: Increment the version number. 2002-05-02 Daiki Ueno * lsdb.el (lsdb-show-buffer): Force set lsdb-pop-up-windows to t. 2002-05-02 Daiki Ueno * README: Add setting to bind lsdb-toggle-buffer to :. 2002-05-02 Daiki Ueno * lsdb.el (lsdb-temp-buffer-show-function): Use defvar to define. (lsdb-hide-buffer): Rename from lsdb-mode-hide-buffer. (lsdb-show-buffer): Rename from lsdb-mode-show-buffer. (lsdb-toggle-buffer): New command. 2002-05-01 Daiki Ueno * lsdb.el (lsdb-temp-buffer-show-function): Fix the last change. (lsdb-wl-temp-buffer-show-function): Likewise. 2002-05-01 Daiki Ueno * README: Fix typo. 2002-05-01 Daiki Ueno * lsdb.el (lsdb-temp-buffer-show-function): New user option. (lsdb-pop-up-windows): New user option. (lsdb-fit-window-to-buffer): Splitted from lsdb-temp-buffer-show-function. (lsdb-mode-show-buffer): New function. (lsdb-gnus-update-record): Don't show LSDB buffer when lsdb-pop-up-windows is nil. (lsdb-wl-update-record): Likewise. (lsdb-mew-update-record): Likewise. (lsdb-wl-insinuate): Set wl-summary-toggle-disp-off-hook, wl-summary-toggle-disp-folder-on-hook, wl-summary-toggle-disp-folder-off-hook, and wl-summary-toggle-disp-folder-message-resumed-hook. (lsdb-wl-temp-buffer-show-function): New function. From Yuuichi Teranishi . 2002-04-30 Daiki Ueno * README: Fix typo. * lsdb.el (lsdb-interesting-header-alist): Use comma as a delimiter of AKA field. (lsdb-complete-name-highlight): Use isearch-lazy-highlight-face if it exists. 2002-04-30 Daiki Ueno * README: Add description about secondary hash tables. 2002-04-30 Daiki Ueno * bbdb-to-lsdb.el: Verify bbdb-record-name is non-nil. 2002-04-30 Daiki Ueno * bbdb-to-lsdb.el: Fix the last change. 2002-04-30 Daiki Ueno * bbdb-to-lsdb.el: Fix the last change. 2002-04-30 Daiki Ueno * lsdb.el: Increment the version number. 2002-04-30 Daiki Ueno * bbdb-to-lsdb.el: New file. 2002-04-30 Daiki Ueno * lsdb.el (lsdb-lookup-full-name-functions): New user option. (lsdb-update-record-functions): New user option. (lsdb-secondary-hash-tables): Defcustom. (lsdb-address-cache): Rename from lsdb-reverse-hash-table. (lsdb-secondary-hash-table-start): Define as function. (lsdb-load-hash-tables): Load a whole list of secondary hash tables. (lsdb-save-hash-tables): Save a whole list of secondary hash tables. (lsdb-maybe-load-secondary-hash-tables): Rename from lsdb-maybe-build-reverse-hash-table. (lsdb-lookup-full-name-from-address-cache): New function. (lsdb-update-address-cache): New function. (lsdb-lookup-full-name-by-fuzzy-matching): New function. (lsdb-last-highlight-overlay): New variable. (lsdb-complete-name-highlight): New function. (lsdb-complete-name-highlight-update): New function. (lsdb-complete-name): Highlight matched pattern. (lsdb-mode): Use make-local-hook instead of make-local-variable. 2002-04-29 Daiki Ueno * lsdb.el (lsdb-entry-type-alist): Add AKA. (lsdb-reverse-hash-table): New function. (lsdb-hash-tables-are-dirty): Rename from lsdb-hash-table-is-dirty. (lsdb-secondary-hash-table-start-format): New constant. (lsdb-secondary-hash-table-start): New macro. (lsdb-read): Splitted from lsdb-load-file. (lsdb-load-hash-tables): New function. (lsdb-insert-hash-table): New function. (lsdb-save-hash-tables): Rename from lsdb-save-file. (lsdb-maybe-build-reverse-hash-table): New function. (lsdb-maybe-load-hash-tables): Rename from lsdb-maybe-load-file. (lsdb-update-record): Look for the existing record from the reverse hash table. 2002-04-29 Daiki Ueno * lsdb.el (lsdb-extract-address-components): Swap the return value. (lsdb-update-record): Follow the over change. (lsdb-expose-x-face): Inherit 'lsdb-record property after calling lsdb-insert-x-face-function. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-interesting-header-alist): Ass List-Id, X-Sequence, Delivered-To to collect mailing-list entries. (lsdb-entry-type-alist): Assert read-only property for creation-date and last-modified. (lsdb-update-records): Don't collect field-body if it doesn't match the REGEXP element of lsdb-interesting-header-alist. (lsdb-complete-name): Sort candidates by the position in string where the pattern appears. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-save-file): Reduce the actual size of the hash table before saving it. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-save-file): Check whether coding-system-name is bound. (lsdb-mode): Use static-if. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-insert-x-face-asynchronously): Check whether the marker buffer is deleted. * README: Add instruction for x-face-e21. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-insert-x-face-asynchronously): Don't generate the work buffer when the X-Face is found in cache. 2002-04-28 Daiki Ueno * lsdb.el (lsdb-wl-insinuate): Add lsdb-mode-save to wl-save-hook. 2002-04-28 Daiki Ueno * lsdb.el: Added Mew interface. (lsdb-mode-hide-buffer): New command. (lsdb-mew-insinuate): New function. (lsdb-mew-update-record): New function. * README: Add instruction for Mew. 2002-04-27 Daiki Ueno * lsdb.el (lsdb-mode-save): Don't ask user for saving the database. 2002-04-27 Daiki Ueno * README: Add description about MU-CITE. 2002-04-27 Daiki Ueno * xbm-thumb.el: Removed. * LSDB-ELS (lsdb-modules-to-compile): Remove xbm-thumb. 2002-04-27 Daiki Ueno * lsdb.el (lsdb-expose-x-face): Fix the last change. 2002-04-27 Daiki Ueno * lsdb.el: Simplify X-Face rendering stuff. (lsdb-x-face): Abolish. (lsdb-display-small-x-face): Abolish. (lsdb-uncompface-program): Abolish. (lsdb-x-face-command-alist): New user option. (lsdb-insert-x-face-function): Set default to lsdb-insert-x-face-asynchronously. (lsdb-shell-file-name): New user option. (lsdb-shell-command-switch): New user option. (lsdb-print-record-hook): Rename from lsdb-display-record-hook. (lsdb-print-record): Call lsdb-print-record-hook. (lsdb-mode-line-buffer-identification) [XEmacs]: Simplified. (lsdb-x-face-available-image-type): New function. (lsdb-call-process-on-string): Abolish. (lsdb-mirror-bits): Abolish. (lsdb-mirror-bytes): Abolish. (lsdb-convert-x-face-to-xbm): Abolish. (lsdb-insert-x-face-asynchronously): New function. 2002-04-27 Daiki Ueno * lsdb.el (lsdb-display-small-x-face): Fixed custom type. 2002-04-27 Daiki Ueno * LSDB-ELS (lsdb-modules-to-compile): Add xbm-thumb. * xbm-thumb.el: New file. * lsdb.el: Require static and path-util. (lsdb-x-face): New custom group. (lsdb-display-small-x-face): New user option. (lsdb-x-face-scale-factor): Abolish. (lsdb-uncompface-program): New user option. (lsdb-insert-x-face-function): Set default to lsdb-insert-x-face. (lsdb-display-records-sort-predicate): New user option. (lsdb-display-records): Sort records with lsdb-display-records-sort-predicate. (lsdb-pointer-xpm): New constant. (lsdb-xemacs-modeline-left-extent): New variable. (lsdb-xemacs-modeline-right-extent): New variable. (lsdb-modeline-buffer-identification): New function. (lsdb-modeline-string): New variable. (lsdb-mode): Set up mode-line-buffer-identification. (lsdb-modeline-update): New function. (lsdb-narrow-to-record): Applied the patch from Hideyuki SHIRAI . (lsdb-mode-save): Don't ask whether to save the database when the argument 'ask is passed. (lsdb-insert-x-face-with-x-face-e21): Abolish. (lsdb-insert-x-face-with-xemacs-glyph): Abolish. (lsdb-call-process-on-string): New function. (lsdb-mirror-bits): New function. (lsdb-mirror-bytes): New constant. (lsdb-convert-x-face-to-xbm): New function. (lsdb-insert-x-face): New function. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-insert-entry): Check entry's score here. (lsdb-mode-edit-entry): Compare entry contents. 2002-04-26 Daiki Ueno * lsdb.el: Require pces for find-coding-system. (lsdb-file-coding-system): Call find-coding-system when setting the default value. (lsdb-save-file): Convert coding-system-name into string. (lsdb-lookup-records): Splitted from lsdb-mode-lookup. (lsdb-mu-attribution): New function. (lsdb-mu-set-attribution): New function. (lsdb-mu-get-prefix-method): New function. (lsdb-mu-get-prefix-register-method): New function. (lsdb-mu-get-prefix-register-verbose-method): New function. (lsdb-mu-insinuate): New function. (lsdb-mu-history): New variable. 2002-04-26 Daiki Ueno * README: New file. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-mode-map): Bind [backspace] (lsdb-mode-lookup): Prepare lsdb-hash-table. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-mode-map): Bind [space] and [delete]. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-current-record): New function. (lsdb-current-entry): Use it. (lsdb-mode-add-entry): Use it. (lsdb-mode-delete-entry): Use it. (lsdb-mode-edit-entry): Use it. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-maphash) [Emacs]: Fixed. 2002-04-26 Daiki Ueno * lsdb.el: Check whether make-hash-table is a subr. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-print-record-function): Abolish. (lsdb-insert-x-face-function): Add setting for XEmacs' xface glyph. (lsdb-known-entry-names): New variable. (lsdb-temp-buffer-show-function): Don't call shrink-window-if-larger-than-buffer twice. (lsdb-display-records): Fixed. (lsdb-insert-entry): Collect entry names for later completion. (lsdb-mode-map): Bind n and p. (lsdb-narrow-to-record): Simplified. (lsdb-mode-lookup-history): New variable. (lsdb-mode-lookup): New command. (lsdb): New alias. (lsdb-mode-add-entry): Complete entry names. (lsdb-mode-next-record): New command. (lsdb-mode-previous-record): New command. (lsdb-wl-insinuate): Add autoload cookie. (lsdb-insert-x-face-with-xemacs-glyph): New function. 2002-04-26 Daiki Ueno * lsdb.el: Fix the last change. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-mode-save): Fixed. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-edit-form-mode-hook): New user option. (lsdb-insert-entry): New function. (lsdb-print-record): Use it. (lsdb-mode-map): New keymap. (lsdb-mode-quit-window): Emulate quit-window in Emacs 21. (lsdb-narrow-to-record): New function. (lsdb-current-entry): New function. (lsdb-mode-add-entry): New command. (lsdb-mode-delete-entry): New command. (lsdb-mode-edit-entry): New command. (lsdb-mode-save): Rename from lsdb-offer-save. (lsdb-edit-form-buffer): New variable. (lsdb-edit-form-done-function): New variable. (lsdb-previous-window-configuration): New variable. (lsdb-edit-form-mode-map): New variable. (lsdb-edit-form-mode): New major mode. (lsdb-edit-form): New function. (lsdb-edit-form-done): New function. (lsdb-edit-form-exit): New function. 2002-04-26 Daiki Ueno * lsdb.el (lsdb-interesting-header-alist): Collect X-URL, X-URI and X-Face. (lsdb-entry-type-alist): Increase the score of 'www. (lsdb-insert-x-face-function): New user option. (lsdb-display-record-hook): New user option. (lsdb-font-lock-keywords): Stop highlighting when a runaway "\r" is found. (lsdb-display-records): New function. (lsdb-display-record): Use it. (lsdb-entry-score): New inline function. (lsdb-print-record): Use it. (lsdb-expose-x-face): New function. (lsdb-x-face-scale-factor): New variable. (lsdb-insert-x-face-with-x-face-e21): New function. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-wl-hide-buffer): New function. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-complete-name): Call lsdb-maybe-load-file before building completion table. 2002-04-25 Daiki Ueno * lsdb.el: Fix typo. 2002-04-25 Daiki Ueno * lsdb.el: Add instructions for Wanderlust. (lsdb-gnus-insinuate-message): Abolish. (lsdb-gethash) [Emacs]: Fixed. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-complete-name): Don't throw an error when there is no candidate. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-update-record): Duplicate record before puthash. (lsdb-last-candidates): New variable. (lsdb-complete-name): Use it. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-entry-type-alist): Increase score of 'organization. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-offer-save): Rename from lsdb-gnus-offer-save. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-hash-table-is-dirty): New variable. (lsdb-gnus-offer-save): Use it. 2002-04-25 Daiki Ueno * lsdb.el (lsdb-interesting-header-alist): Add 'attribution. 2002-04-25 Daiki Ueno * LSDB-CFG, LSDB-ELS, LSDB-MK, Makefile, lsdb.el: Importing the Lovely Sister Database. 2002-04-25 Daiki Ueno * LSDB-CFG, LSDB-ELS, LSDB-MK, Makefile, lsdb.el: Initial revision