jwiegley/alert

'message, 'fringe not working ... logging not happening.

vspinu opened this issue · 11 comments

With no extra configuration nothing seem to work as expected. Logging is not happening. Here is what I do:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/") t)
(setq package-user-dir "~/Dropbox/ELPA")
(package-initialize)

(require 'alert)
(alert "blabla" :style 'fringe) ;; nothing 
(alert "blabla" :style 'message) ;; nothing

M-x alert--log-open-log says [Log4E] Not exist log buffer..

Is this project abandoned? Issue tracker seem to suggest so.

GNU Emacs 25.0.93.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7) of 2016-04-24

It's definitely not abandoned; 10 unattended issues should be weighed against my daily use of this library for several years now, and its use by others. :)

If I might say, I was able to make it work with the following changes at alert-log-notify

        (when (fboundp 'log4e:deflogger)
          (log4e:deflogger "alert" "%t [%l] %m" "%H:%M:%S")

          (when (functionp 'alert--log-set-level)
            (alert--log-set-level alert-log-level))

          ;; HACK: Enable logging here?
          (alert--log-enable-logging) 
          (alert--log-info mes)
     )

Two things with this: the *Alert* buffer name is called *log4e-alert* and alert-log-message must be nil when alert-default-style is 'log unless double logging is okay. I just read up on log4e and a rookie so I really don't know. But an official fix for this would ease my mind as well.

my daily use of this library for several years now, and its use by others. :)

I am looking for a reliable persistent notifications inside emacs. Persistent in the sense that the notification won't disappear till I really payed attention to it.

For instance, if a new message arrived in my slack buffer the notification should be on till I visited that buffer. This is how jabber notifications work. emacs-slack builds on alert and its notifications are far from being useful at the moment.

libnotify is currently broken (#28), so in linux I cannot get persistent notifications working outside emacs either.

Sounds like some bugs need fixing. The behavior you describe is exactly how alert should be working for you: alerts persist until you visit the buffer that raised them, so long as you don't have them configured to automatically disappear (which is the default).

Assuming 'fringe or 'mode-line works, if the current buffer or minibuffer is the that invokes (alert "I love cats" :style 'fringe); the fringe alert is immediately removed by alert-remove-on-command thus making it appear that nothing happened. Ditto with mode-line

My workaround is to use delay it a little bit
(run-at-time 0 nil (lambda () (alert "I love cats" :style 'fringe))).

Just noting

I'm also being confused by the correct way to configure this.

First of all, I have alert-log-messages set to t but no *Alerts* buffer is being created. Second of all, the log4e logging seems to be buggy by default.

As been mentioned earlier, I need to execute alert--log-enable-logging sequence before the alert--log-open-log works.

EDIT: Forgot to mention, that alert--log-enable-logging seems to be initialized lazily, so I need to create a dummy alert before calling the alert--log-enable-logging function.

Perhaps alert-log-notify should do

(when (fboundp 'log4e:deflogger)
          (log4e:deflogger "alert" "%t [%l] %m" "%H:%M:%S")
          (alert--log-enable-logging)
          (when (functionp 'alert--log-set-level)
            (alert--log-set-level alert-log-level)))

?

My init.el workaround is to

(use-package alert
  :defer t
  :config
  (alert-log-notify nil)
  (alert--log-enable-logging))

I installed the stable package and I didn't have any troubles with the message style, but it was missing the 'mode-line' style, which I wanted. I installed the latest unstable version, and none of the styles seems to work. (I'll probably actually just define my own style that modifies the mode-line to say what I want rather than just changing the colour, but I thought it was worth mentioning the difference between the two versions.)

@vincentjgoh Thanks for the note, I'll look into it soon.

First of all, I have alert-log-messages set to t but no Alerts buffer is being created. Second of all, the log4e logging seems to be buggy by default.

IMO the the documentation needs to be updated because *Alerts* is only used when log4e is not available:
But log4e is a dependency of alert. So most users need to use alert--log-open-log instead.

I was also confused by the fact that the log4e based logging function are defined at runtime. And the first message gets lost. See: Ensure log4e logging is enabled when using default log4e functions

I just stumbled across this issue when trying to figure out why I couldn't find an *Alerts* buffer. Thanks @juergenhoetzel, for the info; that's what I needed. It would be helpful to have this clearly documented somewhere.