X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=2fd9a27de8a352385fc00a3564d6d72645618016;hb=42d32713be9a23346de09b84983e1dd3b44b3400;hp=0b698d59a25f2e767c777b72b8a9f626a855e958;hpb=2ca941163da06aed564dab1990fb333fd7457ec2;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 0b698d59..2fd9a27d 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -1,4 +1,4 @@ -;;; notmuch-lib.el --- common variables, functions and function declarations +;;; notmuch-lib.el --- common variables, functions and function declarations -*- lexical-binding: t -*- ;; ;; Copyright © Carl Worth ;; @@ -101,6 +101,7 @@ search results. Note that any filtered searches created by search." :type 'boolean :group 'notmuch-search) +(make-variable-buffer-local 'notmuch-search-oldest-first) (defcustom notmuch-poll-script nil "[Deprecated] Command to run to incorporate new mail into the notmuch database. @@ -192,8 +193,8 @@ will be signaled. Otherwise the output will be returned." (with-temp-buffer - (let* ((status (apply #'call-process notmuch-command nil t nil args)) - (output (buffer-string))) + (let ((status (apply #'call-process notmuch-command nil t nil args)) + (output (buffer-string))) (notmuch-check-exit-status status (cons notmuch-command args) output) output))) @@ -247,8 +248,9 @@ displays both values separately." (let* ((val (notmuch-command-to-string "config" "get" item)) (len (length val))) ;; Trim off the trailing newline (if the value is empty or not - ;; configured, there will be no newline) - (if (and (> len 0) (= (aref val (- len 1)) ?\n)) + ;; configured, there will be no newline). + (if (and (> len 0) + (= (aref val (- len 1)) ?\n)) (substring val 0 -1) val))) @@ -482,8 +484,8 @@ be displayed." ;;; String Utilities (defun notmuch-prettify-subject (subject) - ;; This function is used by `notmuch-search-process-filter' which - ;; requires that we not disrupt its' matching state. + ;; This function is used by `notmuch-search-process-filter', + ;; which requires that we not disrupt its matching state. (save-match-data (if (and subject (string-match "^[ \t]*$" subject)) @@ -538,13 +540,12 @@ This replaces spaces, percents, and double quotes in STR with ;;; Generic Utilities (defun notmuch-plist-delete (plist property) - (let* ((xplist (cons nil plist)) - (pred xplist)) - (while (cdr pred) - (when (eq (cadr pred) property) - (setcdr pred (cdddr pred))) - (setq pred (cddr pred))) - (cdr xplist))) + (let (p) + (while plist + (unless (eq property (car plist)) + (setq p (plist-put p (car plist) (cadr plist)))) + (setq plist (cddr plist))) + p)) ;;; MML Utilities @@ -555,8 +556,10 @@ This replaces spaces, percents, and double quotes in STR with (if (or (string= (cadr st1) "*") (string= (cadr st2) "*")) ;; Comparison of content types should be case insensitive. - (string= (downcase (car st1)) (downcase (car st2))) - (string= (downcase t1) (downcase t2))))) + (string= (downcase (car st1)) + (downcase (car st2))) + (string= (downcase t1) + (downcase t2))))) (defvar notmuch-multipart/alternative-discouraged '(;; Avoid HTML parts. @@ -978,7 +981,7 @@ status." ;; so turn errors into messages. (message "%s" (error-message-string err)))))) -(defun notmuch-start-notmuch-error-sentinel (proc event) +(defun notmuch-start-notmuch-error-sentinel (proc _event) (unless (process-live-p proc) (let ((buffer (process-buffer proc))) (when (buffer-live-p buffer)