summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStephen Gildea <stepheng+emacs@gildea.com>2025-03-27 14:54:47 -0700
committerStephen Gildea <stepheng+emacs@gildea.com>2025-03-27 14:57:14 -0700
commit01f4a0cb6cb15fbbc28e64abd94cb38604a24672 (patch)
tree30d6d76be1e3a93ea7931b481e325113e2760f5b /lisp
parent364c3dbc12e7b6d41ab449dd495c96d08874310e (diff)
downloademacs-01f4a0cb6cb15fbbc28e64abd94cb38604a24672.tar.gz
emacs-01f4a0cb6cb15fbbc28e64abd94cb38604a24672.tar.bz2
emacs-01f4a0cb6cb15fbbc28e64abd94cb38604a24672.zip
MH-E: set default-directory to HOME on entry
* lisp/mh-e/mh-e.el (mh-default-directory, mh-set-default-directory): New variable (defaults to "~/"), new function to use it. * lisp/mh-e/mh-folder.el (mh-rmail, mh-nmail): Call mh-set-default-directory on entry to MH-E (closes: bug#77263).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mh-e/mh-e.el10
-rw-r--r--lisp/mh-e/mh-folder.el10
2 files changed, 17 insertions, 3 deletions
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index e507996c581..f64b02c7bca 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -144,6 +144,10 @@ This directory contains, among other things, the mhl program.")
;;;###autoload
(put 'mh-lib-progs 'risky-local-variable t)
+(defvar mh-default-directory "~/"
+ "Default directory for MH-E folder buffers.
+Set to nil to have MH-E buffers inherit default-directory.")
+
;; Profile Components
(defvar mh-draft-folder nil
@@ -438,6 +442,12 @@ gnus-version)
(error "Bad element: %s" element))))
new-list))
+(defun mh-set-default-directory ()
+ "Set `default-directory' to `mh-default-directory' unless it is nil."
+ (when (stringp mh-default-directory)
+ (setq default-directory (file-name-as-directory
+ (expand-file-name mh-default-directory)))))
+
;;; MH-E Process Support
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el
index 5009c2c4f98..e0c53724f9c 100644
--- a/lisp/mh-e/mh-folder.el
+++ b/lisp/mh-e/mh-folder.el
@@ -51,9 +51,12 @@ the MH mail system."
(interactive "P")
(mh-find-path)
(if arg
- (call-interactively 'mh-visit-folder)
+ (progn
+ (call-interactively 'mh-visit-folder)
+ (mh-set-default-directory))
(unless (get-buffer mh-inbox)
- (mh-visit-folder mh-inbox (symbol-name mh-unseen-seq)))
+ (mh-visit-folder mh-inbox (symbol-name mh-unseen-seq))
+ (mh-set-default-directory))
(mh-inc-folder)))
;;;###autoload
@@ -67,7 +70,8 @@ the MH mail system."
(mh-find-path) ; init mh-inbox
(if arg
(call-interactively 'mh-visit-folder)
- (mh-visit-folder mh-inbox)))
+ (mh-visit-folder mh-inbox))
+ (mh-set-default-directory))
;;; Desktop Integration