X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fliece.el;h=97c3b23dd52e9bab19fd2f5323c2519f63bdce98;hb=c3f1cd9dfa6ab46d4163b14d61fe3faa72513a72;hp=a9c3e0599ec6d5f141b946ebb4bd9c34525de3f3;hpb=abc7ac8a17edfea96946f48fb8f5e89125367855;p=elisp%2Fliece.git diff --git a/lisp/liece.el b/lisp/liece.el index a9c3e05..97c3b23 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -65,12 +65,7 @@ "Mapping from keywords to default values. All keywords that can be used must be listed here.")) -(defadvice save-buffers-kill-emacs - (before liece-save-buffers-kill-emacs activate) - "Prompt user to quit IRC explicitly." - (run-hooks 'liece-before-kill-emacs-hook) ) - -(add-hook 'liece-before-kill-emacs-hook 'liece-command-quit) +(add-hook 'kill-emacs-hook 'liece-command-quit) (defvar liece-tmp-server-name nil "Temporaly server name.") (defvar liece-buffer-last-check-time nil) @@ -202,7 +197,6 @@ If optional argument SAFE is nil, overwrite previous definitions." "/" liece-command-generic ">" end-of-buffer "<" beginning-of-buffer - "!" liece-command-exec "|" liece-command-show-last-kill "a" liece-command-away "b" liece-command-submit-bug-report @@ -230,8 +224,6 @@ If optional argument SAFE is nil, overwrite previous definitions." "t" liece-command-topic "T" liece-command-timestamp "\C-t" liece-command-find-timestamp - "u" liece-command-lusers - "U" liece-command-userhost "v" liece-command-browse-url "w" liece-command-who) @@ -266,11 +258,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "\r" liece-command-enter-message [tab] liece-command-complete [(meta control c) >] liece-command-push - [(meta control c) <] liece-command-pop - [(meta control c) o] liece-command-mode+o - [(meta control c) O] liece-command-mode-o - [(meta control c) v] liece-command-mode+v - [(meta control c) V] liece-command-mode-v) + [(meta control c) <] liece-command-pop) (liece-define-keys (liece-command-map "\C-c" liece-command-mode-map) "\177" liece-command-scroll-down @@ -281,8 +269,6 @@ If optional argument SAFE is nil, overwrite previous definitions." ">" liece-command-next-channel "<" liece-command-previous-channel "a" liece-command-away - "c" liece-command-inline - "\C-a" liece-command-previous-channel "\C-f" liece-command-freeze "\C-j" liece-command-next-channel "\C-n" liece-command-names @@ -291,7 +277,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "L" liece-command-load-vars "M" liece-command-own-freeze "\C-m" liece-command-modec - "o" liece-command-mode+o + "o" liece-command-set-operators "O" liece-command-toggle-nick-buffer-mode "\C-o" liece-command-toggle-channel-buffer-mode "\C-p" liece-command-part @@ -299,16 +285,14 @@ If optional argument SAFE is nil, overwrite previous definitions." "\C-r" mule-caesar-region "s" liece-command-set-window-style "S" liece-command-save-vars - "v" liece-command-mode+v + "v" liece-command-set-voices "\C-v" liece-command-browse-url "\C-y" liece-command-yank-send) (set-keymap-parent liece-command-map liece-dialogue-mode-map) (liece-define-keys liece-nick-mode-map - "o" liece-command-mode+o - "O" liece-command-mode-o - "v" liece-command-mode+v - "V" liece-command-mode-v + "o" liece-command-set-operators + "v" liece-command-set-voices "f" liece-command-finger " " liece-command-nick-scroll-up "\177" liece-command-nick-scroll-down @@ -381,12 +365,19 @@ is running on." (eq 'liece-sentinel (process-sentinel liece-server-process))) (set-process-sentinel liece-server-process nil)) - ;; We cannot send QUIT command unless the process is running. - (when (liece-server-opened) - (if quit-string - (liece-send "QUIT :%s" quit-string) - (liece-send "QUIT")))) - (liece-close-server-internal))) + (if (liece-server-opened) + (if quit-string + (liece-send "QUIT :%s" quit-string) + (liece-send "QUIT")))) + (liece-close-server-internal) + ;; Save settings to the `~/.liece/init.el' file. + (if liece-save-variables-are-dirty + (liece-command-save-vars)) + ;; Reset everything. + (liece-clear-system) + (liece-window-configuration-pop) + ;; Allow the user to do things after cleaning up. + (run-hooks 'liece-exit-hook))) (defmacro liece-server-keyword-bind (plist &rest body) "Return a `let' form that binds all variables in PLIST. @@ -553,47 +544,34 @@ If already connected, just pop up the windows." (liece-intl-load-catalogue)) (if (liece-server-opened) (liece-configure-windows) - (unwind-protect - (progn - (switch-to-buffer - (liece-get-buffer-create liece-command-buffer)) - (unless (eq major-mode 'liece-command-mode) - (liece-command-mode)) - (unless (liece-server-opened) - (liece-start-server confirm))) - (if (not (liece-server-opened)) - (liece-command-quit) - ;; IRC server is successfully open. - (with-current-buffer liece-command-buffer - (setq mode-line-process (concat " " (liece-server-host)))) - (let (buffer-read-only) - (unless liece-keep-buffers - (erase-buffer)) - (sit-for 0)) - - (liece-initialize-buffers) - (liece-configure-windows) - (setq liece-current-channels nil) - (cond - (liece-current-channel - (liece-command-join liece-current-channel)) - (liece-startup-channel - (liece-command-join liece-startup-channel)) - (liece-startup-channel-list - (dolist (chnl liece-startup-channel-list) - (if (listp chnl) - (liece-command-join (car chnl) (cadr chnl)) - (liece-command-join chnl))))) - (unless (string-equal liece-away-message "") - (liece-command-away liece-away-message)) - (run-hooks 'liece-startup-hook) - (setq liece-obarray - (or liece-obarray (make-vector liece-obarray-size nil))) - (unless liece-timers-list-initialized-p - (liece-initialize-timers)) - (liece-command-timestamp) - (message (substitute-command-keys - "Type \\[describe-mode] for help")))))) + (switch-to-buffer (liece-get-buffer-create liece-command-buffer)) + (unless (eq major-mode 'liece-command-mode) + (liece-command-mode)) + (liece-start-server confirm) + (let (buffer-read-only) + (unless liece-keep-buffers + (erase-buffer)) + (sit-for 0)) + (liece-initialize-buffers) + (liece-configure-windows) + (setq liece-current-channels nil) + (let ((startup-channels + (if liece-startup-channel + (list liece-startup-channel) + liece-startup-channel-list))) + (dolist (chnl startup-channels) + (if (listp chnl) + (liece-command-join (car chnl) (cadr chnl)) + (liece-command-join chnl)))) + (unless (string-equal liece-away-message "") + (liece-command-away liece-away-message)) + (run-hooks 'liece-startup-hook) + (setq liece-obarray + (or liece-obarray (make-vector liece-obarray-size nil))) + (unless liece-timers-list-initialized-p + (liece-initialize-timers)) + (liece-command-timestamp) + (message (substitute-command-keys "Type \\[describe-mode] for help")))) ;;;###liece-autoload (defun liece-command-mode () @@ -637,7 +615,7 @@ For a list of the generic commands type \\[liece-command-generic] ? RET. (copy-syntax-table (syntax-table))) (set-syntax-table liece-command-mode-syntax-table) (mapcar - (function (lambda (c) (modify-syntax-entry c "w"))) + (lambda (c) (modify-syntax-entry c "w")) "^[]{}'`")) (run-hooks 'liece-command-mode-hook))