mu4e: avoid some compiler warnings

(require) necessary things etc.

warnings for using "obsolete" code are still there since things should
work on emacs 25.3
This commit is contained in:
Dirk-Jan C. Binnema
2021-03-10 20:49:40 +02:00
parent e2655ba34b
commit 8d1175f511
6 changed files with 63 additions and 65 deletions

View File

@ -392,9 +392,9 @@ Message-ID."
"Complete address STR with predication PRED for ACTION." "Complete address STR with predication PRED for ACTION."
(cond (cond
((eq action nil) ((eq action nil)
(try-completion str mu4e~contacts pred)) (try-completion str mu4e~contacts-hash pred))
((eq action t) ((eq action t)
(all-completions str mu4e~contacts pred)) (all-completions str mu4e~contacts-hash pred))
((eq action 'metadata) ((eq action 'metadata)
;; our contacts are already sorted - just need to tell the ;; our contacts are already sorted - just need to tell the
;; completion machinery not to try to undo that... ;; completion machinery not to try to undo that...
@ -511,7 +511,8 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(set (make-local-variable 'message-send-mail-real-function) nil) (set (make-local-variable 'message-send-mail-real-function) nil)
(make-local-variable 'message-default-charset) (make-local-variable 'message-default-charset)
;; Set to nil to enable `electric-quote-local-mode' to work: ;; Set to nil to enable `electric-quote-local-mode' to work:
(set (make-variable-buffer-local 'comment-use-syntax) nil) (make-local-variable 'comment-use-syntax)
(setq comment-use-syntax nil)
;; message-mode has font-locking, but uses its own faces. Let's ;; message-mode has font-locking, but uses its own faces. Let's
;; use the mu4e-specific ones instead ;; use the mu4e-specific ones instead
(mu4e~compose-remap-faces) (mu4e~compose-remap-faces)
@ -521,7 +522,7 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(mu4e~compose-register-message-save-hooks) (mu4e~compose-register-message-save-hooks)
;; offer completion for e-mail addresses ;; offer completion for e-mail addresses
(when mu4e-compose-complete-addresses (when mu4e-compose-complete-addresses
(unless mu4e~contacts ;; work-around for https://github.com/djcb/mu/issues/1016 (unless mu4e~contacts-hash ;; work-around for https://github.com/djcb/mu/issues/1016
(mu4e~request-contacts-maybe)) (mu4e~request-contacts-maybe))
(mu4e~compose-setup-completion)) (mu4e~compose-setup-completion))
(if mu4e-compose-format-flowed (if mu4e-compose-format-flowed

View File

@ -42,8 +42,6 @@
(require 'mu4e-actions) (require 'mu4e-actions)
(require 'mu4e-message) (require 'mu4e-message)
(eval-when-compile (require 'mu4e-view))
(declare-function mu4e-view "mu4e-view") (declare-function mu4e-view "mu4e-view")
(declare-function mu4e~main-view "mu4e-main") (declare-function mu4e~main-view "mu4e-main")
@ -328,9 +326,6 @@ followed by the docid, followed by `mu4e~headers-docid-post'.")
"Each header starts (invisibly) with the `mu4e~headers-docid-pre', "Each header starts (invisibly) with the `mu4e~headers-docid-pre',
followed by the docid, followed by `mu4e~headers-docid-post'.") followed by the docid, followed by `mu4e~headers-docid-post'.")
(defvar mu4e~headers-view-win nil
"The view window connected to this headers view.")
(defvar mu4e~headers-sort-field-choices (defvar mu4e~headers-sort-field-choices
'( ("date" . :date) '( ("date" . :date)
("from" . :from) ("from" . :from)
@ -1249,27 +1244,6 @@ docid is not found."
(mu4e-error "Cannot find message with docid %S" docid))))) (mu4e-error "Cannot find message with docid %S" docid)))))
;;; Queries & searching ;;; Queries & searching
(defcustom mu4e-query-rewrite-function 'identity
"Function that takes a search expression string, and returns a
possibly changed search expression string.
This function is applied on the search expression just before
searching, and allows users to modify the query.
For instance, we could change and of workmail into
\"maildir:/long-path-to-work-related-emails\", by setting the function
(setq mu4e-query-rewrite-function
(lambda(expr)
(replace-regexp-in-string \"workmail\"
\"maildir:/long-path-to-work-related-emails\" expr)))
It is good to remember that the replacement does not understand
anything about the query, it just does text replacement."
:type 'function
:group 'mu4e)
(defvar mu4e~headers-mode-line-label "") (defvar mu4e~headers-mode-line-label "")
(defun mu4e~headers-update-mode-line () (defun mu4e~headers-update-mode-line ()
"Update mode-line settings." "Update mode-line settings."

View File

@ -1,4 +1,4 @@
;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e) -*- lexical-binding: t; -*- -*- lexical-binding: t -*- ;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e) -*- lexical-binding: t; -*-
;; Copyright (C) 2019- Christophe Troestler ;; Copyright (C) 2019- Christophe Troestler
@ -52,8 +52,11 @@
(require 'gnus-icalendar) (require 'gnus-icalendar)
(require 'cl-lib) (require 'cl-lib)
(eval-when-compile (require 'mu4e-mark)) (require 'mu4e-mark)
(eval-when-compile (require 'mu4e-vars)) (require 'mu4e-utils)
(require 'mu4e-headers)
(require 'mu4e-view)
(require 'mu4e-vars)
;;;###autoload ;;;###autoload
(defun mu4e-icalendar-setup () (defun mu4e-icalendar-setup ()
@ -79,7 +82,7 @@
(gnus-icalendar-additional-identities (mu4e-personal-addresses 'no-regexp)) (gnus-icalendar-additional-identities (mu4e-personal-addresses 'no-regexp))
(reply (gnus-icalendar-with-decoded-handle (reply (gnus-icalendar-with-decoded-handle
handle handle
(let ((gnus-icalendar-find-if (lambda(pred seq) nil))) (let ((gnus-icalendar-find-if (lambda(_pred _seq) nil)))
(gnus-icalendar-event-reply-from-buffer (gnus-icalendar-event-reply-from-buffer
(current-buffer) status (gnus-icalendar-identities))))) (current-buffer) status (gnus-icalendar-identities)))))
(msg (mu4e-message-at-point 'noerror)) (msg (mu4e-message-at-point 'noerror))
@ -141,8 +144,8 @@ See `gnus-icalendar-event-reply-from-buffer' for the possible
STATUS values. BUFFER-NAME is the name of the buffer holding the STATUS values. BUFFER-NAME is the name of the buffer holding the
response in icalendar format." response in icalendar format."
(let ((message-signature nil)) (let ((message-signature nil))
(let ((mu4e-compose-cite-function #'mu4e~icalendar-delete-citation) (let ((_mu4e-compose-cite-function #'mu4e~icalendar-delete-citation)
(mu4e-sent-messages-behavior 'delete) (_mu4e-sent-messages-behavior 'delete)
(mu4e-compose-reply-recipients 'sender)) (mu4e-compose-reply-recipients 'sender))
(mu4e~compose-handler 'reply original-msg)) (mu4e~compose-handler 'reply original-msg))
;; Make sure the recipient is the organizer ;; Make sure the recipient is the organizer

View File

@ -1,11 +1,10 @@
;;; mu4e-org -- Org-links to mu4e messages/queries -*- lexical-binding: t -*- ;;; mu4e-org -- Org-links to mu4e messages/queries -*- lexical-binding: t -*-
;; Copyright (C) 2012-2020 Dirk-Jan C. Binnema ;; Copyright (C) 2012-2021 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Keywords: outlines, hypermedia, calendar, mail ;; Keywords: outlines, hypermedia, calendar, mail
;; Version: 0.0
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
@ -29,6 +28,8 @@
;;; Code: ;;; Code:
(require 'org) (require 'org)
(require 'mu4e-view)
(require 'mu4e-utils)
(defgroup mu4e-org nil (defgroup mu4e-org nil
"Settings for the org-mode related functionality in mu4e." "Settings for the org-mode related functionality in mu4e."

View File

@ -667,9 +667,8 @@ process."
(defun mu4e~update-contacts (contacts &optional tstamp) (defun mu4e~update-contacts (contacts &optional tstamp)
"Receive a sorted list of CONTACTS. "Receive a sorted list of CONTACTS.
Each of the contacts has the form Each of the contacts has the form
(FULL_EMAIL_ADDRESS . RANK) and fill the hash (FULL_EMAIL_ADDRESS . RANK) and fill `mu4e~contacts-hash' with
`mu4e~contacts' with it, with each contact mapped to an integer it, with each contact mapped to an integer for their ranking.
for their ranking.
This is used by the completion function in mu4e-compose." This is used by the completion function in mu4e-compose."
;; We have our nicely sorted list, map them to a list ;; We have our nicely sorted list, map them to a list
@ -677,8 +676,8 @@ This is used by the completion function in mu4e-compose."
;; to sort them there. It would have been so much easier if emacs ;; to sort them there. It would have been so much easier if emacs
;; allowed us to use the sorted-list as-is, but no such luck. ;; allowed us to use the sorted-list as-is, but no such luck.
(let ((n 0)) (let ((n 0))
(unless mu4e~contacts (unless mu4e~contacts-hash
(setq mu4e~contacts (make-hash-table :test 'equal :weakness nil (setq mu4e~contacts-hash (make-hash-table :test 'equal :weakness nil
:size (length contacts)))) :size (length contacts))))
(dolist (contact contacts) (dolist (contact contacts)
(cl-incf n) (cl-incf n)
@ -690,13 +689,13 @@ This is used by the completion function in mu4e-compose."
(when address ;; note the explicit deccode; the strings we get are utf-8, (when address ;; note the explicit deccode; the strings we get are utf-8,
;; but emacs doesn't know yet. ;; but emacs doesn't know yet.
(puthash (decode-coding-string address 'utf-8) (puthash (decode-coding-string address 'utf-8)
(plist-get contact :rank) mu4e~contacts)))) (plist-get contact :rank) mu4e~contacts-hash))))
(setq mu4e~contacts-tstamp (or tstamp "0")) (setq mu4e~contacts-tstamp (or tstamp "0"))
(unless (zerop n) (unless (zerop n)
(mu4e-index-message "Contacts updated: %d; total %d" (mu4e-index-message "Contacts updated: %d; total %d"
n (hash-table-count mu4e~contacts))))) n (hash-table-count mu4e~contacts-hash)))))
(defun mu4e-contacts-info () (defun mu4e-contacts-info ()
"Display information about the cache used for contacts "Display information about the cache used for contacts
@ -711,12 +710,13 @@ completion; for testing/debugging."
(insert (format "only addresses seen after: %s\n" (insert (format "only addresses seen after: %s\n"
(or mu4e-compose-complete-only-after "no restrictions"))) (or mu4e-compose-complete-only-after "no restrictions")))
(when mu4e~contacts (when mu4e~contacts-hash
(insert (format "number of contacts cached: %d\n\n" (insert (format "number of contacts cached: %d\n\n"
(hash-table-count mu4e~contacts))) (hash-table-count mu4e~contacts-hash)))
(let ((contacts)) (let ((contacts))
(maphash (lambda (addr rank) (maphash (lambda (addr rank)
(setq contacts (cons (cons rank addr) contacts))) mu4e~contacts) (setq contacts (cons (cons rank addr) contacts)))
mu4e~contacts-hash)
(setq contacts (sort contacts (setq contacts (sort contacts
(lambda(cell1 cell2) (< (car cell1) (car cell2))))) (lambda(cell1 cell2) (< (car cell1) (car cell2)))))
(dolist (contact contacts) (dolist (contact contacts)
@ -837,13 +837,13 @@ When successful, call FUNC (if non-nil) afterwards."
(mu4e~maildirs-with-query))))) (mu4e~maildirs-with-query)))))
;; maybe request the list of contacts, automatically refreshed after ;; maybe request the list of contacts, automatically refreshed after
;; reindexing ;; reindexing
(unless mu4e~contacts (mu4e~request-contacts-maybe))) (unless mu4e~contacts-hash (mu4e~request-contacts-maybe)))
(defun mu4e-clear-caches () (defun mu4e-clear-caches ()
"Clear any cached resources." "Clear any cached resources."
(setq (setq
mu4e-maildir-list nil mu4e-maildir-list nil
mu4e~contacts nil mu4e~contacts-hash nil
mu4e~contacts-tstamp "0")) mu4e~contacts-tstamp "0"))
(defun mu4e~stop () (defun mu4e~stop ()

View File

@ -279,6 +279,25 @@ differ from the number you get from a 'real' query."
:version "1.3.9" :version "1.3.9"
:group 'mu4e) :group 'mu4e)
(defcustom mu4e-query-rewrite-function 'identity
"Function that takes a search expression string, and returns a
possibly changed search expression string.
This function is applied on the search expression just before
searching, and allows users to modify the query.
For instance, we could change and of workmail into
\"maildir:/long-path-to-work-related-emails\", by setting the function
(setq mu4e-query-rewrite-function
(lambda(expr)
(replace-regexp-in-string \"workmail\"
\"maildir:/long-path-to-work-related-emails\" expr)))
It is good to remember that the replacement does not understand
anything about the query, it just does text replacement."
:type 'function
:group 'mu4e)
(defun mu4e-bookmarks () (defun mu4e-bookmarks ()
"Get `mu4e-bookmarks' in the (new) format, converting from the "Get `mu4e-bookmarks' in the (new) format, converting from the
@ -1031,7 +1050,7 @@ with SPC and therefore is not visible in buffer list.")
;;;; Other ;;;; Other
(defvar mu4e~contacts nil (defvar mu4e~contacts-hash nil
"Hash that maps contacts (ie. 'name <e-mail>') to an integer for sorting. "Hash that maps contacts (ie. 'name <e-mail>') to an integer for sorting.
We need to keep this information around to quickly re-sort We need to keep this information around to quickly re-sort
subsets of the contacts in the completions function in subsets of the contacts in the completions function in