unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Two patches for mairix.el
@ 2021-05-01 14:30 Daniel Semyonov
  2021-05-01 14:40 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Semyonov @ 2021-05-01 14:30 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

Hi,

I've recently begun to use Emacs' interface for mairix(1) for indexing
and searching through my mail, and have noticed two small issues.

The first one is that the main interactive entry points for mairix.el
aren't autoloaded (I'm guessing the present mechanism for autoloading
wasn't available when it was written?). The first patch adds appropriate
';;;###autoload' lines before commands which can serve as such.

The second is that `mairix-search-options' isn't actually used, even
though both the manual and the docstring seem to indicate that it should
be. The second patch modifies `mairix-call-mairix' slightly to add the options
specified.

Note: I haven't completed copyright assignment yet (I need to get a
disclaimer from my university still, might take a while), but I hope
those changes are trivial enough to be accepted without it.
Also, apologies in advance if I should've sent these patches separately
(they seemed trivial enough to be sent together).

Regards, Daniel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: first patch --]
[-- Type: text/x-patch, Size: 2702 bytes --]

From 35a8992135bf580fdfee2204f3d0251129d7c165 Mon Sep 17 00:00:00 2001
From: Daniel Semyonov <cmstr@dsemy.com>
Date: Sat, 1 May 2021 17:01:22 +0300
Subject: [PATCH] * lisp/net/mairix.el: Autoload main interactive functions.

---
 lisp/net/mairix.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index 024d118f2d..adc41b6068 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -328,6 +328,7 @@ mairix-vm-fetch-field
 
 ;;;; Main interactive functions
 
+;;;###autoload
 (defun mairix-search (search threads)
   "Call Mairix with SEARCH.
 If THREADS is non-nil, also display whole threads of found
@@ -342,6 +343,7 @@ mairix-search
 	 threads)
     (mairix-show-folder mairix-search-file)))
 
+;;;###autoload
 (defun mairix-use-saved-search ()
   "Use a saved search for querying Mairix."
   (interactive)
@@ -374,6 +376,7 @@ mairix-save-search
 	(setcdr (assoc name mairix-saved-searches) mairix-last-search))))
   (mairix-select-save))
 
+;;;###autoload
 (defun mairix-edit-saved-searches-customize ()
   "Edit the list of saved searches in a customization buffer."
   (interactive)
@@ -386,6 +389,8 @@ mairix-edit-saved-searches-customize
 (make-string 65 ?=) "\n")))
 
 (autoload 'mail-strip-quoted-names "mail-utils")
+
+;;;###autoload
 (defun mairix-search-from-this-article (threads)
   "Search messages from sender of the current article.
 This is effectively a shortcut for calling `mairix-search' with
@@ -402,6 +407,7 @@ mairix-search-from-this-article
 	 threads)
       (error "No function for obtaining mail header specified"))))
 
+;;;###autoload
 (defun mairix-search-thread-this-article ()
   "Search thread for the current article.
 This is effectively a shortcut for calling `mairix-search'
@@ -423,12 +429,14 @@ mairix-search-thread-this-article
     (mairix-search
      (format "m:%s" mid) t)))
 
+;;;###autoload
 (defun mairix-widget-search-based-on-article ()
   "Create mairix query based on current article using widgets."
   (interactive)
   (mairix-widget-search
    (mairix-widget-get-values)))
 
+;;;###autoload
 (defun mairix-edit-saved-searches ()
   "Edit current mairix searches."
   (interactive)
@@ -441,6 +449,7 @@ mairix-edit-saved-searches
 
 (defvar mairix-widgets)
 
+;;;###autoload
 (defun mairix-widget-search (&optional mvalues)
   "Create mairix query interactively using graphical widgets.
 MVALUES may contain values from current article."
@@ -470,6 +479,7 @@ mairix-widget-search
   (widget-setup)
   (goto-char (point-min)))
 
+;;;###autoload
 (defun mairix-update-database ()
   "Call mairix for updating the database for SERVERS.
 Mairix will be called asynchronously unless
-- 
2.31.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: second patch --]
[-- Type: text/x-patch, Size: 1327 bytes --]

From 703796d033c6c0579dd7be1939087e6cf5cbe679 Mon Sep 17 00:00:00 2001
From: Daniel Semyonov <cmstr@dsemy.com>
Date: Sat, 1 May 2021 17:03:07 +0300
Subject: [PATCH] * lisp/net/mairix.el: Use `mairix-search-options' as
 documented.

`mairix-search' is documented to call `mairix-command' together with
the options specified in `mairix-search-options'.
However, the previous implementation made no use of
`mairix-search-options', requiring the user to customize
`mairix-command' in order to pass options to mairix(1).
---
 lisp/net/mairix.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index adc41b6068..e1d35c2a85 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -531,8 +531,11 @@ mairix-call-mairix
 If FILE is nil, use default.  If THREADS is non-nil, also return
 whole threads.  Function returns t if messages were found."
   (let* ((commandsplit (split-string mairix-command))
-	 (args (cons (car commandsplit)
-		     `(nil ,(get-buffer-create mairix-output-buffer) nil)))
+	 (args (cons
+                (car commandsplit)
+		(append
+                 `(nil ,(get-buffer-create mairix-output-buffer) nil)
+                 mairix-search-options)))
 	 rval)
     (with-current-buffer mairix-output-buffer
       (erase-buffer))
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-15  8:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 14:30 [PATCH] Two patches for mairix.el Daniel Semyonov
2021-05-01 14:40 ` Eli Zaretskii
2021-05-01 15:19   ` Daniel Semyonov
2021-05-01 15:29     ` Eli Zaretskii
2021-05-15  8:13       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).