]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-hello.el
emacs: do not call `notmuch-hello-mode' on update
[notmuch] / emacs / notmuch-hello.el
index 917ad3bbe4e8ea45a8f52790021bee661842514a..81b26059ab1a01dfbfdd5d93bd2f1a385f219511 100644 (file)
@@ -138,6 +138,11 @@ Typically \",\" in the US and UK and \".\" in Europe."
   :group 'notmuch
   :type 'string)
 
+(defcustom notmuch-hello-mode-hook nil
+  "Functions called after entering `notmuch-hello-mode'."
+  :group 'notmuch
+  :type 'hook)
+
 (defvar notmuch-hello-url "http://notmuchmail.org"
   "The `notmuch' web site.")
 
@@ -188,8 +193,8 @@ Typically \",\" in the US and UK and \".\" in Europe."
                collect elem))
     ;; Add the new one.
     (customize-save-variable 'notmuch-saved-searches
-                            (push (cons name search)
-                                  notmuch-saved-searches))
+                            (add-to-list 'notmuch-saved-searches
+                                         (cons name search) t))
     (message "Saved '%s' as '%s'." search name)
     (notmuch-hello-update)))
 
@@ -355,6 +360,7 @@ Complete list of currently available key bindings:
  (use-local-map notmuch-hello-mode-map)
  (setq major-mode 'notmuch-hello-mode
        mode-name "notmuch-hello")
+ (run-mode-hooks 'notmuch-hello-mode-hook)
  ;;(setq buffer-read-only t)
 )
 
@@ -397,11 +403,16 @@ Complete list of currently available key bindings:
                     (progn
                       (widget-forward 1)
                       (widget-value (widget-at)))
-                  (error nil)))))
+                  (error nil))))
+       (inhibit-read-only t))
+
+    ;; Delete all editable widget fields.  Editable widget fields are
+    ;; tracked in a buffer local variable `widget-field-list' (and
+    ;; others).  If we do `erase-buffer' without properly deleting the
+    ;; widgets, some widget-related functions are confused later.
+    (mapc 'widget-delete widget-field-list)
 
-    (kill-all-local-variables)
-    (let ((inhibit-read-only t))
-      (erase-buffer))
+    (erase-buffer)
 
     (unless (eq major-mode 'notmuch-hello-mode)
       (notmuch-hello-mode))