From c87fb3e2776da488ee5704bf0123fddc8c964c30 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 25 Apr 2002 17:30:41 +0000 Subject: [PATCH] * lsdb.el (lsdb-complete-name): Don't throw an error when there is no candidate. --- lsdb.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lsdb.el b/lsdb.el index 637758b..e981e48 100644 --- a/lsdb.el +++ b/lsdb.el @@ -437,6 +437,7 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." ;;;_. Completion (defvar lsdb-last-completion nil) (defvar lsdb-last-candidates nil) +(defvar lsdb-last-candidates-pointer nil) (defun lsdb-complete-name () "Complete the user full-name or net-address before point" @@ -446,16 +447,14 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point))) - (string - (if (eq last-command this-command) - lsdb-last-completion - (buffer-substring start (point)))) - (pattern - (concat "\\<" string)) + pattern (case-fold-search t) (completion-ignore-case t)) (unless (eq last-command this-command) - (setq lsdb-last-candidates nil) + (setq lsdb-last-candidates nil + lsdb-last-candidates-pointer nil + lsdb-last-completion (buffer-substring start (point)) + pattern (concat "\\<" lsdb-last-completion)) (lsdb-maphash (lambda (key value) (let ((net (cdr (assq 'net value)))) @@ -471,12 +470,12 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (if (string-match pattern (car net)) (push (car net) lsdb-last-candidates)) (setq net (cdr net)))))) - lsdb-hash-table) - (setq lsdb-last-completion string)) - (unless lsdb-last-candidates - (error "No match")) - (delete-region start (point)) - (insert (pop lsdb-last-candidates)))) + lsdb-hash-table)) + (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))))) ;;;_. Major Mode (`lsdb-mode') Implementation (define-derived-mode lsdb-mode fundamental-mode "LSDB" -- 1.7.10.4