Commit 3b0468c4 authored by Julien Danjou's avatar Julien Danjou Committed by Katsumi Yamaoka
Browse files

Merge changes made in Gnus trunk.

sieve.el (sieve-buffer-script-name): New local variable to store sieve script name.
 (sieve-edit-script): Store sieve script name.
 (sieve-upload): Use sieve script name when uploading.
 (sieve-upload): Use substitute-command-keys.
 (sieve-edit-script): Use substitute-command-keys.
 (sieve-refresh-scriptlist): Use substitute-command-keys.
 (sieve-manage-mode-map): Define keymap properly.
 (sieve-manage-mode): Do not set mode name manually, change mode-name to
 (sieve-refresh-scriptlist): Use substitute-command-keys."Sieve-manage".  Remove commented code about cvs.
 (sieve-manage-quit): New function.
 (sieve-manage-mode-map): Bind 'q' to sieve-manage-quit.
gnus-gravatar.el: Use gnus-with-article-buffer.
gnus-art.el (gnus-with-article-buffer): Check that the gnus-article-buffer is alive.
parent 0e0b2989
2011-02-28 Julien Danjou <julien@danjou.info>
* sieve.el (sieve-buffer-script-name): New local variable to store
sieve script name.
(sieve-edit-script): Store sieve script name.
(sieve-upload): Use sieve script name when uploading.
(sieve-upload): Use substitute-command-keys.
(sieve-edit-script): Use substitute-command-keys.
(sieve-refresh-scriptlist): Use substitute-command-keys.
(sieve-manage-mode-map): Define keymap properly.
(sieve-manage-mode): Do not set mode name manually, change mode-name to
(sieve-refresh-scriptlist): Use substitute-command-keys."Sieve-manage".
Remove commented code about cvs.
(sieve-manage-quit): New function.
(sieve-manage-mode-map): Bind 'q' to sieve-manage-quit.
2011-02-27 Lars Magne Ingebrigtsen <larsi@gnus.org>
 
* gnus-group.el (gnus-import-other-newsrc-file): New function.
......@@ -23,6 +39,13 @@
* gnus-demon.el (gnus-demon-init): run-with-timer should be called with
numerical parameters.
 
2011-02-25 Julien Danjou <julien@danjou.info>
* gnus-gravatar.el: Use gnus-with-article-buffer.
* gnus-art.el (gnus-with-article-buffer): Check that the
gnus-article-buffer is alive.
2011-02-24 Teodor Zlatanov <tzz@lifelogs.com>
 
* auth-source.el (auth-source-creation-prompts): New variable to manage
......
......@@ -1725,9 +1725,10 @@ Initialized from `text-mode-syntax-table.")
(put 'gnus-with-article-headers 'edebug-form-spec '(body))
(defmacro gnus-with-article-buffer (&rest forms)
`(with-current-buffer gnus-article-buffer
(let ((inhibit-read-only t))
,@forms)))
`(when (buffer-live-p gnus-article-buffer)
(with-current-buffer gnus-article-buffer
(let ((inhibit-read-only t))
,@forms))))
(put 'gnus-with-article-buffer 'lisp-indent-function 0)
(put 'gnus-with-article-buffer 'edebug-form-spec '(body))
......
......@@ -80,9 +80,8 @@ If nil, default to `gravatar-size'."
"Insert GRAVATAR for ADDRESS in HEADER in current article buffer.
Set image category to CATEGORY."
(unless (eq gravatar 'error)
(with-current-buffer gnus-article-buffer
(gnus-with-article-buffer
(let ((mark (point-marker))
(inhibit-read-only t)
(inhibit-point-motion-hooks t)
(case-fold-search t))
(save-restriction
......
......@@ -98,39 +98,40 @@ require \"fileinto\";
(defvar sieve-manage-buffer nil)
(defvar sieve-buffer-header-end nil)
(defvar sieve-buffer-script-name nil
"The real script name of the buffer.")
(make-local-variable 'sieve-buffer-script-name)
;; Sieve-manage mode:
(defvar sieve-manage-mode-map nil
(defvar sieve-manage-mode-map
(let ((map (make-sparse-keymap)))
;; various
(define-key map "?" 'sieve-help)
(define-key map "h" 'sieve-help)
(define-key map "q" 'sieve-bury-buffer)
;; activating
(define-key map "m" 'sieve-activate)
(define-key map "u" 'sieve-deactivate)
(define-key map "\M-\C-?" 'sieve-deactivate-all)
;; navigation keys
(define-key map "\C-p" 'sieve-prev-line)
(define-key map [up] 'sieve-prev-line)
(define-key map "\C-n" 'sieve-next-line)
(define-key map [down] 'sieve-next-line)
(define-key map " " 'sieve-next-line)
(define-key map "n" 'sieve-next-line)
(define-key map "p" 'sieve-prev-line)
(define-key map "\C-m" 'sieve-edit-script)
(define-key map "f" 'sieve-edit-script)
(define-key map "o" 'sieve-edit-script-other-window)
(define-key map "r" 'sieve-remove)
(define-key map "q" 'sieve-manage-quit)
(define-key map [(down-mouse-2)] 'sieve-edit-script)
(define-key map [(down-mouse-3)] 'sieve-manage-mode-menu)
map)
"Keymap for `sieve-manage-mode'.")
(if sieve-manage-mode-map
()
(setq sieve-manage-mode-map (make-sparse-keymap))
(suppress-keymap sieve-manage-mode-map)
;; various
(define-key sieve-manage-mode-map "?" 'sieve-help)
(define-key sieve-manage-mode-map "h" 'sieve-help)
(define-key sieve-manage-mode-map "q" 'sieve-bury-buffer)
;; activating
(define-key sieve-manage-mode-map "m" 'sieve-activate)
(define-key sieve-manage-mode-map "u" 'sieve-deactivate)
(define-key sieve-manage-mode-map "\M-\C-?" 'sieve-deactivate-all)
;; navigation keys
(define-key sieve-manage-mode-map "\C-p" 'sieve-prev-line)
(define-key sieve-manage-mode-map [up] 'sieve-prev-line)
(define-key sieve-manage-mode-map "\C-n" 'sieve-next-line)
(define-key sieve-manage-mode-map [down] 'sieve-next-line)
(define-key sieve-manage-mode-map " " 'sieve-next-line)
(define-key sieve-manage-mode-map "n" 'sieve-next-line)
(define-key sieve-manage-mode-map "p" 'sieve-prev-line)
(define-key sieve-manage-mode-map "\C-m" 'sieve-edit-script)
(define-key sieve-manage-mode-map "f" 'sieve-edit-script)
(define-key sieve-manage-mode-map "o" 'sieve-edit-script-other-window)
(define-key sieve-manage-mode-map "r" 'sieve-remove)
(define-key sieve-manage-mode-map [(down-mouse-2)] 'sieve-edit-script)
(define-key sieve-manage-mode-map [(down-mouse-3)] 'sieve-manage-mode-menu))
(easy-menu-define sieve-manage-mode-menu sieve-manage-mode-map
"Sieve Menu."
'("Manage Sieve"
......@@ -138,21 +139,21 @@ require \"fileinto\";
["Activate script" sieve-activate t]
["Deactivate script" sieve-deactivate t]))
(define-derived-mode sieve-manage-mode fundamental-mode "SIEVE"
(define-derived-mode sieve-manage-mode fundamental-mode "Sieve-manage"
"Mode used for sieve script management."
(setq mode-name "SIEVE")
(buffer-disable-undo (current-buffer))
(setq truncate-lines t)
(easy-menu-add sieve-manage-mode-menu sieve-manage-mode-map))
(put 'sieve-manage-mode 'mode-class 'special)
;; This is necessary to allow correct handling of \\[cvs-mode-diff-map]
;; in substitute-command-keys.
;(fset 'sieve-manage-mode-map sieve-manage-mode-map)
;; Commands used in sieve-manage mode:
(defun sieve-manage-quit ()
"Quit."
(interactive)
(kill-buffer (current-buffer)))
(defun sieve-activate (&optional pos)
(interactive "d")
(let ((name (sieve-script-at-point)) err)
......@@ -204,7 +205,10 @@ require \"fileinto\";
(switch-to-buffer (get-buffer-create "template.siv"))
(insert sieve-template))
(sieve-mode)
(message "Press C-c C-l to upload script to server.")))
(setq sieve-buffer-script-name name)
(message
(substitute-command-keys
"Press \\[sieve-upload] to upload script to server."))))
(defmacro sieve-change-region (&rest body)
"Turns off sieve-region before executing BODY, then re-enables it after.
......@@ -337,13 +341,18 @@ Server : " server ":" (or port "2000") "
;; get list of script names and print them
(let ((scripts (sieve-manage-listscripts sieve-manage-buffer)))
(if (null scripts)
(insert (format (concat "No scripts on server, press RET on %s to "
"create a new script.\n") sieve-new-script))
(insert (format (concat "%d script%s on server, press RET on a script "
"name edits it, or\npress RET on %s to create "
"a new script.\n") (length scripts)
(if (eq (length scripts) 1) "" "s")
sieve-new-script)))
(insert
(substitute-command-keys
(format
"No scripts on server, press \\[sieve-edit-script] on %s to create a new script.\n"
sieve-new-script)))
(insert
(substitute-command-keys
(format (concat "%d script%s on server, press \\[sieve-edit-script] on a script "
"name edits it, or\npress \\[sieve-edit-script] on %s to create "
"a new script.\n") (length scripts)
(if (eq (length scripts) 1) "" "s")
sieve-new-script))))
(save-excursion
(sieve-insert-scripts (list sieve-new-script))
(sieve-insert-scripts scripts)))
......@@ -363,15 +372,15 @@ Server : " server ":" (or port "2000") "
;;;###autoload
(defun sieve-upload (&optional name)
(interactive)
(unless name
(setq name (buffer-name)))
(when (or (get-buffer sieve-buffer) (call-interactively 'sieve-manage))
(let ((script (buffer-string)) err)
(with-current-buffer (get-buffer sieve-buffer)
(setq err (sieve-manage-putscript name script sieve-manage-buffer))
(setq err (sieve-manage-putscript
(or name sieve-buffer-script-name (buffer-name))
script sieve-manage-buffer))
(if (sieve-manage-ok-p err)
(message (concat
"Sieve upload done. Use `C-c RET' to manage scripts."))
(message (substitute-command-keys
"Sieve upload done. Use \\[sieve-manage] to manage scripts."))
(message "Sieve upload failed: %s" (nth 2 err)))))))
;;;###autoload
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment