iqbalansari / mu4e-alert

Desktop notifications and modeline display for mu4e
GNU General Public License v3.0
155 stars 22 forks source link

Compatibility with emacs 25.1.50.2 (?) #17

Closed LukeBatten closed 8 years ago

LukeBatten commented 8 years ago

I can't seem to get this package working, whereas all other packages have been fine to install. mu4e-alert-enable-mode-line-display, doesn't display at all, and neither does mu4e-alert-enable-notifications, even if manually set, or set in my init file. Even if I receive an email, and I'm in emacs /mu4e, I still don't get a notification.

I'm working on Ubuntu 14.04, emacs-snapshot and I installed via MELPA.

iqbalansari commented 8 years ago

Hi @LukeBatten ,

Thanks for the bug report and sorry for the late reply, I tried reproducing the behavior you mentioned on Emacs master but was not able to reproduce it. Can you run the following in ielm (run M-xielmRET) and post the output.

(mu4e-alert--get-mu-unread-mails (lambda (mails)
                                   (message (format "Got %d mails"
                                                    (length mails)))))

If all goes well you should see the count of unread mails in the minibuffer, otherwise there should ideally be some error messages printed in the *Messages* buffer

Thanks

LukeBatten commented 8 years ago

Hello @iqbalansari ,

I ran this in ielm (in emacs-snapshot), and here is the output:

(closure
 ((callback lambda
        (mails)
        (message
         (format "Got %d mails"
             (length mails))))
  t)
 (process _)
 (if
     (memql
      (process-status process)
      '(exit signal))
     (progn
       (funcall callback
        (mu4e-alert--parse-mails
         (process-buffer process))))))

In minibuffer: "Got 0 mails", but I have several unread mails.

No errors occur when I load emacs-snapshot. So, loaded up emacs24, and get the following:

Warning (initialization): An error occurred while loading `/home/berg/.emacs':

Symbol's function definition is void: function-put

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

So, running emacs24 --debug-init, I get:

Debugger entered--Lisp error: (void-function function-put)
  (function-put (quote log4e:deflogger) (quote lisp-indent-function) 0)
  require(log4e nil t)
  byte-code("\300\301\302\303#\210\300\304\302\303#\210\300\305\302\303#\210\306\307\302\310\311\312%\210\313\314\315\316\317\320\311\307&\210\313\321\322\323\317\324\311\307&\210\313\325\326\327\317\330\311\307&\210\313\331\332\333\317\334\311\307&\210\313\335\336\337\317\340\311\307&\210\313\341\342\343\317\340\311\307&\210\313\344\345\346\317\340\311\307&\210\313\347\302\350\317\351\311\307&\210\313\352\303\353\317\351\311\307&\210\313\354\355\356\317\357\311\307&\207" [require gntp nil t notifications log4e custom-declare-group alert "Notification system for Emacs similar to Growl" :group emacs custom-declare-variable alert-severity-faces (quote ((urgent . alert-urgent-face) (high . alert-high-face) (moderate . alert-moderate-face) (normal . alert-normal-face) (low . alert-low-face) (trivial . alert-trivial-face))) "Faces associated by default with alert severities." :type (alist :key-type symbol :value-type color) alert-severity-colors (quote ((urgent . "red") (high . "orange") (moderate . "yellow") (normal . "green") (low . "blue") (trivial . "purple"))) "Colors associated by default with alert severities.\nThis is used by styles external to Emacs that don't understand faces." (alist :key-type symbol :value-type color) alert-log-severity-functions (quote ((urgent . alert--log-fatal) (high . alert--log-error) (moderate . alert--log-warn) (normal . alert--log-info) (low . alert--log-debug) (trivial . alert--log-trace))) "Log4e logging functions" (alist :key-type symbol :value-type color) alert-log-level (quote normal) "Minimum level of messages to log" symbol alert-reveal-idle-time 15 "If idle this many seconds, rules will match the `idle' property." integer alert-persist-idle-time 900 "If idle this many seconds, all alerts become persistent.\nThis can be overriden with the Never Persist option (:never-persist)." alert-fade-time 5 "If not idle, alerts disappear after this many seconds.\nThe amount of idle time is governed by `alert-persist-idle-time'." alert-hide-all-notifications "If non-nil, no alerts are ever shown to the user." boolean alert-log-messages "If non-nil, all alerts are logged to the *Alerts* buffer." alert-default-icon (concat data-directory "images/icons/hicolor/scalable/apps/emacs.svg") "Filename of default icon to show for libnotify-alerts." string] 8)
  require(alert)
  eval-buffer(#<buffer  *load*-448920> nil "/home/berg/.emacs.d/lisp/mu4e-alert.el" nil t)  ; Reading at buffer position 1191
  load-with-code-conversion("/home/berg/.emacs.d/lisp/mu4e-alert.el" "/home/berg/.emacs.d/lisp/mu4e-alert.el" nil t)
  (mu4e-alert-set-default-style (quote notifications))
  eval-buffer(#<buffer  *load*> nil "/home/berg/.emacs" nil t)  ; Reading at buffer position 6419
  load-with-code-conversion("/home/berg/.emacs" "/home/berg/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "\205\262� \306=\203�\307\310Q\202;� \311=\204�\307\312Q\202;�\313\307\314\315#\203*�\316\202;�\313\307\314\317#\203:�\320\nB\321\202;�\316\322\323\322\211#\210\322=\203a�\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`�\210\203\243�\330!\331\232\203\243�\332!\211\333P\334!\203}�\211\202\210�\334!\203\207�\202\210�\314\262\203\241�\335\"\203\237�\336\337#\210\340\341!\210\266\f?\205\260�\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
  command-line()
  normal-top-level()

I tried switching from (mu4e-alert-set-default-style 'notifications) to (mu4e-alert-set-default-style 'libnotify), to no avail.

In emacs24, mu4e-alert-enable-mode-line-display and mu4e-alert-enable-notifications just display Symbol's function definition is void: function-put.

I ran the suggested code in ielm on emacs24, and get:

*** Eval error *** Symbol's function definition is void: mu4e-alert--get-mu-unread-mails

Thanks

iqbalansari commented 8 years ago

Hi,

The Symbol's function definition is void: function-put is because you are using file byte-compiled using newer version of Emacs (snapshot) on an older version of Emacs, the error would go away if you byte compile the file.

In minibuffer: "Got 0 mails", but I have several unread mails.

This seems to be the real problem.

Could you execute the following the ielm

(require 'mu4e)
(format "sh -c '%s'"
        (string-join (append (list mu4e-mu-binary
                                   "find"
                                   "--nocolor"
                                   "-o"
                                   "sexp"
                                   "--sortfield=d"
                                   (format "--maxnum=%d" mu4e-alert-max-messages-to-process))
                             (when mu4e-headers-skip-duplicates
                               (list "-u"))
                             (when mu4e-mu-home
                               (list (concat "--muhome=" mu4e-mu-home)))
                             (split-string mu4e-alert-interesting-mail-query))
                     " "))

At the end of it you should get something like

sh -c '<path-to-mu>/mu find --nocolor -o sexp --sortfield=d --maxnum=500 -u flag:unread AND NOT flag:trashed'

Run that in you shell, if everything works as expected you would see some sexps printed on screen, otherwise there will be some error message. Please post the error message, I think that will help in debugging this issue

Thanks

iqbalansari commented 8 years ago

Hi,

Any update on this?

LukeBatten commented 8 years ago

Hello @iqbalansari (been travelling),

Upon entering the second sexp in input, I get:

"sh -c '/usr/local/bin/mu find --nocolor -o sexp --sortfield=d --maxnum=500 -u flag:unread AND NOT flag:trashed'"

Running in both zsh and bash, I get: mu: Unknown option --maxnum=500.

Upon removing this option, I actually get all my emails through (in sexps):

i.e.

( :docid 1754 :subject "THE SUBJECT TITLE APPEARS HERE" :from (("Sender name" . "email@theiremail.co.uk")) :to (("MYEMAILHERE@domain.com" . "MYEMAILHERE@domain.com")) :date (22435 29624 0) :size 274209 :message-id "6f60766c-6390-49e1-b2b5-b5f266172103@xtnvmta488.xt.local" :path "/home/berg/Maildir/Spam/new/1470342217_1.6594.bergLinux,U=110,FMD5=4b4b643246a6b95b2136ea99e0e5f614:2," :maildir "/Spam" :priority normal :flags (new unread) )

So, perhaps the error is related to option --maxnum=500?

Thanks

iqbalansari commented 8 years ago

It seems you are using an old version of mu, maxnum parameter seems to have been introduced back in 2013, what does the following report?

/usr/local/bin/mu --version

Thanks

LukeBatten commented 8 years ago

It would seem so. I guess that mu4e-alert is only compatible with a more recent version (perhaps the minimum version of mu/mu4e should be noted on the requirements).

mu (mail indexer/searcher) version 0.9.9.5 Copyright (C) 2008-2013 Dirk-Jan C. Binnema License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

LukeBatten commented 8 years ago

It seems as if mu stopped updating their google code repository back in 2013, so I believe I got the last version from this:

https://code.google.com/archive/p/mu0/downloads

iqbalansari commented 8 years ago

It seems as if mu stopped updating their google code repository back in 2013, so I believe I got the last version from this

That makes sense. I am assuming you can update to the newer version, if so may I close this issue as resolved?

I guess that mu4e-alert is only compatible with a more recent version (perhaps the minimum version of mu/mu4e should be noted on the requirements

That is a valid point I will update the README to mention this.

LukeBatten commented 8 years ago

After installing the most recent version of mu4e, I can confirm that mu4e-alert now works, and you can mark this issue as resolved!