]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-lib.el
emacs: inline notmuch-split-content-type
[notmuch] / emacs / notmuch-lib.el
index d7c6b737974cafeffa937b5834ea072c51e1cdf1..2c8de32868018529c50567f068050b539e39736a 100644 (file)
@@ -287,18 +287,6 @@ it, in which case it is killed."
       (bury-buffer)
     (kill-buffer)))
 
-(defun notmuch-documentation-first-line (symbol)
-  "Return the first line of the documentation string for SYMBOL."
-  (let ((doc (documentation symbol)))
-    (if doc
-       (with-temp-buffer
-         (insert (documentation symbol t))
-         (goto-char (point-min))
-         (let ((beg (point)))
-           (end-of-line)
-           (buffer-substring beg (point))))
-      "")))
-
 (defun notmuch-prefix-key-description (key)
   "Given a prefix key code, return a human-readable string representation.
 
@@ -331,7 +319,10 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."
                  (or (and (symbolp binding)
                           (get binding 'notmuch-doc))
                      (and (functionp binding)
-                          (notmuch-documentation-first-line binding))))
+                          (let ((doc (documentation binding)))
+                            (and doc
+                                 (string-match "\\`.+" doc)
+                                 (match-string 0 doc))))))
            tail)))
   tail)
 
@@ -543,14 +534,10 @@ This replaces spaces, percents, and double quotes in STR with
       (setq pred (cddr pred)))
     (cdr xplist)))
 
-(defun notmuch-split-content-type (content-type)
-  "Split content/type into 'content' and 'type'."
-  (split-string content-type "/"))
-
 (defun notmuch-match-content-type (t1 t2)
   "Return t if t1 and t2 are matching content types, taking wildcards into account."
-  (let ((st1 (notmuch-split-content-type t1))
-       (st2 (notmuch-split-content-type t2)))
+  (let ((st1 (split-string t1 "/"))
+       (st2 (split-string t2 "/")))
     (if (or (string= (cadr st1) "*")
            (string= (cadr st2) "*"))
        ;; Comparison of content types should be case insensitive.