diff --git a/mu4e/mu4e-proc.el b/mu4e/mu4e-proc.el index 1457de19..3b7cea4d 100644 --- a/mu4e/mu4e-proc.el +++ b/mu4e/mu4e-proc.el @@ -90,14 +90,13 @@ the length (in hex).") mu4e~proc-process nil mu4e~proc-buf nil)) -(defun mu4e~proc-is-running () +(defun mu4e~proc-running-p () "Whether the mu process is running." (when (and mu4e~proc-process (memq (process-status mu4e~proc-process) '(run open listen connect stop))) t)) - (defsubst mu4e~proc-eat-sexp-from-buf () "'Eat' the next s-expression from `mu4e~proc-buf'. Note: this is a string, not an emacs-buffer. `mu4e~proc-buf gets its contents from the @@ -293,7 +292,7 @@ terminates." (defsubst mu4e~proc-send-command (frm &rest args) "Send as command to the mu server process; start the process if needed." - (unless (mu4e~proc-is-running) + (unless (mu4e~proc-running-p) (mu4e~proc-start)) (let ((cmd (apply 'format frm args))) (mu4e-log 'to-server "%s" cmd) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index f0ff52de..280bb1d0 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -580,17 +580,20 @@ This is used by the completion function in mu4e-compose." (mu4e-error "%s (%S) does not exist" path var)))))) +(defun mu4e-running-p () + "Whether mu4e is running -- that is, the server process is live." + (mu4e~proc-running-p)) + (defun mu4e~start (&optional func) "If mu4e is already running, execute function FUNC (if non-nil). Otherwise, check various requirements, then start mu4e. When succesful, call FUNC (if non-nil) afterwards." ;; if we're already running, simply go to the main view - (if (mu4e~proc-is-running) ;; already running? + (if (mu4e-running-p) ;; already running? (when func ;; yes! run func if defined (funcall func)) (progn ;; no! do some checks, set up pong handler and ping the server - (lexical-let ((func func)) (mu4e~check-requirements) ;; set up the 'pong' handler func @@ -635,7 +638,8 @@ FUNC (if non-nil) afterwards." (mapcar (lambda (buf) (with-current-buffer buf - (when (member major-mode '(mu4e-headers-mode mu4e-view-mode mu4e-main-mode)) + (when (member major-mode + '(mu4e-headers-mode mu4e-view-mode mu4e-main-mode)) (kill-buffer)))) (buffer-list))) @@ -667,7 +671,7 @@ into the process buffer." (read-passwd mu4e~get-mail-ask-password) "\n")) ;; TODO kill process? - (error "Get-mail process requires a password but was not called interactively"))) + (error "Get-mail process requires a password"))) (when (process-buffer proc) (insert msg))))) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index ebdc4d0b..ca83b198 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1030,16 +1030,17 @@ configuration, so it is used for images. @section Displaying rich-text messages For displaying messages, @t{mu4e} normally prefers the plain-text version for -messages consisting of both a plain-text and an html (rich-text) version of +messages that consist of both a plain-text and an html (rich-text) version of its body-text. If there is only an html-version, or if the plain-text version is too short in -comparison with the html part, @t{mu4e} tries to convert the html into -plain-text for display. The default way to do that is to use the @t{emacs} -built-in @code{html2text} function. However, you can set the variable -@code{mu4e-html2text-command} to some external program, which is then used -instead. This program is expected to take html from standard input and write -plain text in @t{utf-8} encoding on standard output. +comparison with the html part@footnote{this is for the case where the +text-part only says that all the content is in the html-part}, @t{mu4e} tries +to convert the html into plain-text for display. The default way to do that is +to use the @t{emacs} built-in @code{html2text} function. However, you can set +the variable @code{mu4e-html2text-command} to some external program, which is +then used instead. This program is expected to take html from standard input +and write plain text in @t{utf-8} encoding on standard output. An obvious choice for this is the program that is actually @emph{called} @t{html2text}@footnote{@url{http://www.mbayer.de/html2text/}}, which you can @@ -2769,6 +2770,8 @@ The user is now presented with: @item @code{mu4e-ask-maildir}: ask for a maildir; try one of the shortcuts (@code{mu4e-maildir-shortcuts}), or the full set of available maildirs. +@item @code{mu4e-running-p}: return @code{t} if the @t{mu4e} process is +running, @code{nil} otherwise. @item @code{mu4e-log} logs to the @t{mu4e} debugging log if it is enabled; see @code{mu4e-toggle-logging}. @item @code{mu4e-message}, @code{mu4e-warning}, @code{mu4e-error} are the @t{mu4e} smart equivalents of the normal @t{elisp} @code{message}, @@ -2782,8 +2785,8 @@ functions. @node How it works @appendix How it works -While not necessarily interesting for all users of @t{mu4e}, for some it may -be interesting to know how @t{mu4e} does its job. +While perhaps not interesting for all users of @t{mu4e}, some curious souls +may want to know how @t{mu4e} does its job. @menu * High-level overview:: @@ -2795,7 +2798,7 @@ be interesting to know how @t{mu4e} does its job. @node High-level overview @section High-level overview -On a high level, we can summarize the structure of the @t{mu4e} system using +At a high level, we can summarize the structure of the @t{mu4e} system using some ascii-art: @example