diff options
| author | Leo Liu | 2011-03-22 19:30:05 +0800 |
|---|---|---|
| committer | Leo Liu | 2011-03-22 19:30:05 +0800 |
| commit | 0b4e93f177fc551b8ef523ab13da7842273abad2 (patch) | |
| tree | 04dcef077a4ce7e1f9ff79946190fdf0a4cb165c | |
| parent | 90346de2b2ad3e071a7f0c3bf0c7a6e7bb5b0ac0 (diff) | |
| download | emacs-0b4e93f177fc551b8ef523ab13da7842273abad2.tar.gz emacs-0b4e93f177fc551b8ef523ab13da7842273abad2.zip | |
Handle the case when re-search-backward errs
because point is not located after rcirc-prompt-end-marker.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 36 |
2 files changed, 28 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 954c68c0d2f..9f9ffc7990c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-03-22 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * net/rcirc.el (rcirc-completion-at-point): Return nil if point is | ||
| 4 | located before rcirc-prompt-end-marker. | ||
| 5 | (rcirc-complete): Error if point is not after rcirc prompt. | ||
| 6 | Handle the case when table is nil. | ||
| 7 | |||
| 1 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> | 8 | 2011-03-22 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 9 | ||
| 3 | * custom.el (custom--inhibit-theme-enable): Make it affect only | 10 | * custom.el (custom--inhibit-theme-enable): Make it affect only |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 71aa0dd22bc..999a6968012 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -828,18 +828,21 @@ The list is updated automatically by `defun-rcirc-command'.") | |||
| 828 | 828 | ||
| 829 | (defun rcirc-completion-at-point () | 829 | (defun rcirc-completion-at-point () |
| 830 | "Function used for `completion-at-point-functions' in `rcirc-mode'." | 830 | "Function used for `completion-at-point-functions' in `rcirc-mode'." |
| 831 | (let* ((beg (save-excursion | 831 | (and (rcirc-looking-at-input) |
| 832 | (if (re-search-backward " " rcirc-prompt-end-marker t) | 832 | (let* ((beg (save-excursion |
| 833 | (1+ (point)) | 833 | (if (re-search-backward " " rcirc-prompt-end-marker t) |
| 834 | rcirc-prompt-end-marker))) | 834 | (1+ (point)) |
| 835 | (table (if (and (= beg rcirc-prompt-end-marker) | 835 | rcirc-prompt-end-marker))) |
| 836 | (eq (char-after beg) ?/)) | 836 | (table (if (and (= beg rcirc-prompt-end-marker) |
| 837 | (delete-dups | 837 | (eq (char-after beg) ?/)) |
| 838 | (nconc | 838 | (delete-dups |
| 839 | (sort (copy-sequence rcirc-client-commands) 'string-lessp) | 839 | (nconc (sort (copy-sequence rcirc-client-commands) |
| 840 | (sort (copy-sequence rcirc-server-commands) 'string-lessp))) | 840 | 'string-lessp) |
| 841 | (rcirc-channel-nicks (rcirc-buffer-process) rcirc-target)))) | 841 | (sort (copy-sequence rcirc-server-commands) |
| 842 | (list beg (point) table))) | 842 | 'string-lessp))) |
| 843 | (rcirc-channel-nicks (rcirc-buffer-process) | ||
| 844 | rcirc-target)))) | ||
| 845 | (list beg (point) table)))) | ||
| 843 | 846 | ||
| 844 | (defvar rcirc-completions nil) | 847 | (defvar rcirc-completions nil) |
| 845 | (defvar rcirc-completion-start nil) | 848 | (defvar rcirc-completion-start nil) |
| @@ -848,6 +851,8 @@ The list is updated automatically by `defun-rcirc-command'.") | |||
| 848 | "Cycle through completions from list of nicks in channel or IRC commands. | 851 | "Cycle through completions from list of nicks in channel or IRC commands. |
| 849 | IRC command completion is performed only if '/' is the first input char." | 852 | IRC command completion is performed only if '/' is the first input char." |
| 850 | (interactive) | 853 | (interactive) |
| 854 | (unless (rcirc-looking-at-input) | ||
| 855 | (error "Point not located after rcirc prompt")) | ||
| 851 | (if (eq last-command this-command) | 856 | (if (eq last-command this-command) |
| 852 | (setq rcirc-completions | 857 | (setq rcirc-completions |
| 853 | (append (cdr rcirc-completions) (list (car rcirc-completions)))) | 858 | (append (cdr rcirc-completions) (list (car rcirc-completions)))) |
| @@ -855,9 +860,10 @@ IRC command completion is performed only if '/' is the first input char." | |||
| 855 | (table (rcirc-completion-at-point))) | 860 | (table (rcirc-completion-at-point))) |
| 856 | (setq rcirc-completion-start (car table)) | 861 | (setq rcirc-completion-start (car table)) |
| 857 | (setq rcirc-completions | 862 | (setq rcirc-completions |
| 858 | (all-completions (buffer-substring rcirc-completion-start | 863 | (and rcirc-completion-start |
| 859 | (cadr table)) | 864 | (all-completions (buffer-substring rcirc-completion-start |
| 860 | (nth 2 table))))) | 865 | (cadr table)) |
| 866 | (nth 2 table)))))) | ||
| 861 | (let ((completion (car rcirc-completions))) | 867 | (let ((completion (car rcirc-completions))) |
| 862 | (when completion | 868 | (when completion |
| 863 | (delete-region rcirc-completion-start (point)) | 869 | (delete-region rcirc-completion-start (point)) |