From: Evgenii T. <evg...@us...> - 2008-03-05 14:32:00
|
Update of /cvsroot/emacs-jabber/emacs-jabber In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv15644 Modified Files: jabber-muc-nick-completion.el Log Message: Fix for in-line nick completion (dirty hacks...) Index: jabber-muc-nick-completion.el =================================================================== RCS file: /cvsroot/emacs-jabber/emacs-jabber/jabber-muc-nick-completion.el,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- jabber-muc-nick-completion.el 4 Mar 2008 15:27:51 -0000 1.7 +++ jabber-muc-nick-completion.el 5 Mar 2008 14:31:10 -0000 1.8 @@ -123,8 +123,9 @@ (defun jabber-muc-beginning-of-line () "Return position of line begining." (save-excursion + (if (looking-back jabber-muc-completion-delimiter) + (backward-char (+ (length jabber-muc-completion-delimiter) 1))) (skip-syntax-backward "^-") - (unless (looking-at "^") (error "Can't find beginning of line!")) (point))) ;;; One big hack: @@ -133,9 +134,9 @@ (let ((last-tried (car he-tried-table))) (when last-tried (goto-char he-string-beg) - (delete-char - (+ (length last-tried) - (length jabber-muc-completion-delimiter)))))) + (delete-char (length last-tried)) + (ignore-errors (delete-char (length jabber-muc-completion-delimiter))) + ))) (defun try-expand-jabber-muc (old) "Try to expand target nick in MUC according to last speaking time. @@ -160,11 +161,19 @@ (jabber-muc-completion-delete-last-tried) (he-reset-string))) ()) - (let ((subst (concat (car he-expand-list) jabber-muc-completion-delimiter))) + (let ((subst (if (eq (line-beginning-position) (jabber-muc-beginning-of-line)) + (concat (car he-expand-list) jabber-muc-completion-delimiter) + (car he-expand-list)))) (if (not (string= he-search-string "")) (he-substitute-string subst) (jabber-muc-completion-delete-last-tried) - (insert subst))) + (progn + (insert subst) + (if (looking-back (concat "^" (car he-expand-list))) + (unless (looking-back (concat "^" (car he-expand-list) jabber-muc-completion-delimiter)) + (insert jabber-muc-completion-delimiter))) + ) + )) (setq he-tried-table (cons (car he-expand-list) (cdr he-tried-table))) (setq he-expand-list (cdr he-expand-list)) t))) |