From 8a3d4c27de9f5c38a9336ce58faac998a79b0f30 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sat, 10 Nov 2012 14:01:17 +0100 Subject: [PATCH] improve doc-strings The first sentence should summarize the variable's or function's purpose and it should fit on the first line. Change existing doc-string by: * Move first sentence onto first line even if that makes it _a bit_ long. * Move additional notes out of first sentence and add them later, possibly as complete sentences. * If I am uncertain whether doing the above would alter the meaning, _don't_ do it. * If fitting the initial sentence on the first line would require a complete rewrite of the doc-string _don't_ do so unless it is very easy to do. * Remove indentation from second and later lines if it is there to align them with the first in the source code, instead of in `describe-*' output. * Make "pullet point" lists a bit more consistent. Obviously this does not fix all problems but it's a start. --- mu4e/mu4e-actions.el | 17 ++--- mu4e/mu4e-compose.el | 26 ++++---- mu4e/mu4e-draft.el | 39 +++++------ mu4e/mu4e-headers.el | 152 +++++++++++++++++++++++-------------------- mu4e/mu4e-main.el | 8 +-- mu4e/mu4e-mark.el | 30 +++++---- mu4e/mu4e-message.el | 39 ++++++----- mu4e/mu4e-proc.el | 107 +++++++++++++++--------------- mu4e/mu4e-utils.el | 85 ++++++++++++------------ mu4e/mu4e-vars.el | 102 +++++++++++++++-------------- mu4e/mu4e-view.el | 123 +++++++++++++++++----------------- mu4e/mu4e.el | 2 +- mu4e/org-mu4e.el | 35 +++++----- 13 files changed, 397 insertions(+), 368 deletions(-) diff --git a/mu4e/mu4e-actions.el b/mu4e/mu4e-actions.el index c111145a..cafb71d6 100644 --- a/mu4e/mu4e-actions.el +++ b/mu4e/mu4e-actions.el @@ -37,8 +37,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e-action-count-lines (msg) - "Count the number of lines in the e-mail message. Works for -headers view and message-view." + "Count the number of lines in the e-mail message. +Works for headers view and message-view." (message "Number of lines: %s" (shell-command-to-string (concat "wc -l < " (shell-quote-argument (mu4e-message-field msg :path)))))) @@ -53,8 +53,8 @@ headers view and message-view." "Path to the msg2pdf toy.") (defun mu4e-action-view-as-pdf (msg) - "Convert the message to pdf, then show it. Works for the message -view." + "Convert the message to pdf, then show it. +Works for the message view." (unless (file-executable-p mu4e-msg2pdf) (mu4e-error "msg2pdf not found; please set `mu4e-msg2pdf'")) (let* ((pdf @@ -74,8 +74,9 @@ view." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e-action-view-in-browser (msg) - "View the body of the message in a web browser. You can influence -the browser to use with the variable `browse-url-generic-program'." + "View the body of the message in a web browser. +You can influence the browser to use with the variable +`browse-url-generic-program'." (let* ((html (mu4e-message-field msg :body-html)) (txt (mu4e-message-field msg :body-txt)) (tmpfile (format "%s%x.html" temporary-file-directory (random t)))) @@ -127,8 +128,8 @@ with `mu4e-compose-attach-captured-message'." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar mu4e-org-contacts-file nil - "File to store contact information for org-contacts. Needed by - `mu4e-action-add-org-contact'.") + "File to store contact information for org-contacts. +Needed by `mu4e-action-add-org-contact'.") (eval-when-compile ;; silence compiler warning about free variable (unless (require 'org-capture nil 'noerror) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 8dfed9e2..0f29435d 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -107,16 +107,16 @@ sent folder." :group 'mu4e-compose) (defvar mu4e-compose-pre-hook nil - "Hook run just *before* message composition starts. If the -compose-type is either /reply/ or /forward/, the variable + "Hook run just *before* message composition starts. +If the compose-type is either /reply/ or /forward/, the variable `mu4e-compose-parent-message' points to the message replied to / being forwarded / edited.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e-compose-attach-captured-message () - "Insert the last captured message (through -`mu4e-action-capture-message') file as an attachment." + "Insert the last captured message file as an attachment. +Messages are captured with `mu4e-action-capture-message'." (interactive) (unless mu4e-captured-message (mu4e-warn "No message has been captured")) @@ -145,8 +145,8 @@ being forwarded / edited.") ;; `mu4e-sent-messages-behavior'. (defun mu4e~compose-setup-fcc-maybe () - "Maybe setup Fcc, based on `mu4e-sent-messages-behavior'. If -needed, set the Fcc header, and register the handler function." + "Maybe setup Fcc, based on `mu4e-sent-messages-behavior'. +If needed, set the Fcc header, and register the handler function." (let* ((mdir (case mu4e-sent-messages-behavior (delete nil) @@ -174,8 +174,8 @@ needed, set the Fcc header, and register the handler function." (defun mu4e~compose-register-message-save-hooks () "Just before saving, we remove the mail-header-separator; just - after saving we restore it; thus, the separator should never - appear on disk." +after saving we restore it; thus, the separator should never +appear on disk." (add-hook 'before-save-hook 'mu4e~draft-remove-mail-header-separator nil t) (add-hook 'after-save-hook @@ -442,9 +442,9 @@ for draft messages." (mu4e-compose 'forward)) (defun mu4e-compose-edit () - "Edit the draft message at point in the headers buffer. This is -only possible if the message at point is, in fact, a draft -message." + "Edit the draft message at point in the headers buffer. +This is only possible if the message at point is, in fact, a +draft message." (interactive) (mu4e-compose 'edit)) @@ -457,8 +457,8 @@ message." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; address completion; inspired by org-contacts.el (defun mu4e~compose-complete-contact (&optional start) - "Complete the text at START with a contact (ie. either 'name -' or 'email')." + "Complete the text at START with a contact. +Ie. either 'name ' or 'email')." (interactive) (let ((mail-abbrev-mode-regexp mu4e~compose-address-fields-regexp) (eoh ;; end-of-headers diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 8b3a95fc..b4567200 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -38,16 +38,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e~draft-user-agent-construct () - "Return the User-Agent string for mu4e. This is either the value -of `mu4e-user-agent', or, if not set, a string based on the versions -of mu4e and emacs." + "Return the User-Agent string for mu4e. +This is either the value of `mu4e-user-agent', or, if not set, a +string based on the versions of mu4e and emacs." (format "mu4e %s; emacs %s" mu4e-mu-version emacs-version)) (defun mu4e~draft-cite-original (msg) - "Return a cited version of the original message MSG (ie., the -plist). This function use gnus' `message-cite-function', and as -such all its settings apply." + "Return a cited version of the original message MSG as a plist. +This function use gnus' `message-cite-function', and as such all +its settings apply." (with-temp-buffer (when (fboundp 'mu4e-view-message-text) ;; keep bytecompiler happy (insert (mu4e-view-message-text msg)) @@ -61,8 +61,8 @@ such all its settings apply." (buffer-string)))) (defun mu4e~draft-header (hdr val) - "Return a header line of the form HDR: VAL\n. If VAL is nil, -return nil." + "Return a header line of the form \"HDR: VAL\". +If VAL is nil, return nil." (when val (format "%s: %s\n" hdr val))) (defun mu4e~draft-references-construct (msg) @@ -97,9 +97,10 @@ e-mail addresses. If LST is nil, returns nil." lst ", "))) (defun mu4e~draft-address-cell-equal (cell1 cell2) - "Return t if cell1 and cell2 have the same e-mail - address (case-insensitively), nil otherwise. cell1 and cell2 are - cons cells (NAME . EMAIL)." + "Return t if CELL1 and CELL2 have the same e-mail address. +The comparison is done case-insensitively. If the cells done +match return nil. CELL1 and CELL2 are cons cells of the +form (NAME . EMAIL)." (string= (downcase (or (cdr cell1) "")) (downcase (or (cdr cell2) "")))) @@ -174,9 +175,9 @@ nil, function returns nil." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun mu4e~draft-insert-mail-header-separator () - "Insert `mail-header-separator' in the first empty line of the -message. message-mode needs this line to know where the headers end -and the body starts. Note, in `mu4e-compose-mode, we use + "Insert `mail-header-separator' in the first empty line of the message. +`message-mode' needs this line to know where the headers end and +the body starts. Note, in `mu4e-compose-mode', we use `before-save-hook' and `after-save-hook' to ensure that this separator is never written to the message file. Also see `mu4e-remove-mail-header-separator'." @@ -211,8 +212,8 @@ never hits the disk. Also see `mu4e~draft-insert-mail-header-separator." (replace-match ""))))) (defun mu4e~draft-user-wants-reply-all (origmsg) - "Ask user whether she wants to reply to *all* recipients if there -are more than 1 (based on ORIGMSG)." + "Ask user whether she wants to reply to *all* recipients. +If there is just one recipient of ORIGMSG do nothing." (let* ((recipnum (+ (length (mu4e~draft-create-to-lst origmsg)) (length (mu4e~draft-create-cc-lst origmsg t)))) @@ -226,8 +227,8 @@ are more than 1 (based on ORIGMSG)." (eq response 'all))) (defun mu4e~draft-message-filename-construct (&optional flagstr) - "Construct a randomized name for a message file with flags FLAGSTR; it looks -something like + "Construct a randomized name for a message file with flags FLAGSTR. +It looks something like