Lluis <[email protected]> writes:
Hi,
> * I _must_ use "emacs -batch -l configfile -eval '....'" to get the
> data, as emacsclient has no '-batch' option.
I use something similar here and let emacs construct the command.
--8<---------------cut here---------------start------------->8---
(defun th-notify (title text &optional width icon)
(let* ((width (or width 300))
(icon (or icon
"/usr/share/emacs/23.0.91/etc/images/icons/hicolor/24x24/apps/emacs.png"))
(ti (replace-regexp-in-string "\\([^\\]\\)'" "\\1\\\\'" title))
(te (replace-regexp-in-string
"\\([\n]\\)" "\\\\\\\\\\\\n"
(replace-regexp-in-string "\\([^\\]\\)'" "\\1\\\\'" text)))
(cmd (concat "echo \"naughty.notify({ "
"title = '" ti "', "
"text = '" te "', "
"width = " (number-to-string width) ", "
"timeout = 9999999, "
"icon = '" icon "' })\" "
"| awesome-client - ")))
(shell-command-to-string cmd)))
(defun th-org-agenda-notification ()
(interactive)
(save-excursion
(save-window-excursion
(let ((file "/tmp/org-agenda.txt"))
(org-agenda-list)
(org-write-agenda file)
(with-temp-buffer
(insert-file-contents file)
(th-notify "Org agenda for this week"
(buffer-substring-no-properties
(point-min)
(point-max))
650))))))
--8<---------------cut here---------------end--------------->8---
Now calling
emacsclient -e '(th-org-agenda-notification)'
should result in a naughty popup showing the agenda. (It doesn't work,
though, cause the text seems to be to long.)
If you don't want to have the need to add those functions on the emacs
side, you could still use --eval/-e and wrap the function definitions
and the call in a `progn'.
emacsclient -e '(progn \
(defun th-notify () ...)\
(defun th-org-agenda-notification () ...) \
(th-org-agenda-notification))'
Bye,
Tassilo
--
Windows: So easy to admin, even a worm can do it.
--
To unsubscribe, send mail to [email protected].