dbus error in emacs - emacs

I am trying to use notify.el on OS X, but every time get next error:
Symbol's value as variable is void: dbus-message-type-method-call
emacs --debug-init gives next output:
Debugger entered--Lisp error: (void-variable dbus-message-type-method-call)
dbus-call-method(:session "org.freedesktop.Notifications" "/org/freedesktop/DBus" "org.freedesktop.DBus.Peer" "Ping")
byte-code("\305^H!\203^S^#\306 \n^K\f\307\310^H&^G\202^Z^#\306 \n^K\f\307%?\207" [timeout bus service dbus-path-dbus dbus-interface-peer natnump dbus-call-method "Ping" :timeout] 8)
dbus-ping(:session "org.freedesktop.Notifications")
(and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications"))
(cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications")) (defvar notify-id 0 "Current D-Bus notification$
(setq notify-method (cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications")) (defvar notify-id 0 "Curren$
(cond ((null notify-method) (setq notify-method (cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications"))$
eval-buffer(#<buffer *load*-569235> nil "/Users/araeris/.emacs.d/packages/notify/notify.el" nil t) ; Reading at buffer position 3614
load-with-code-conversion("/Users/araeris/.emacs.d/packages/notify/notify.el" "/Users/araeris/.emacs.d/packages/notify/notify.el" nil t)
require(notify)
(if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (symbol-name name))) (require name))
(progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (symbol-name name))) (require name)))
(while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (sym$
(let* ((--cl-var-- packages) (name nil)) (while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-n$
(progn (let* ((--cl-var-- packages) (name nil)) (while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory ...) "pa$
eval-buffer(#<buffer *load*> nil "/Users/araeris/.emacs.d/init.el" nil t) ; Reading at buffer position 1796
load-with-code-conversion("/Users/araeris/.emacs.d/init.el" "/Users/araeris/.emacs.d/init.el" t t)
load("/Users/araeris/.emacs.d/init" t t)
#[0 "^H\205\262^# \306=\203^Q^#\307^H\310Q\202;^# \311=\204^^^#\307^H\312Q\202;^#\313\307\314\315#\203*^#\316\202;^#\313\307\314\317#\203:^#\320\nB^R\321\202;^#\316\322^S\323^A\322\211#\210^K\322=\$
command-line()
normal-top-level()
Does anyone knows how to handle it?
P. S. I already installed dbus via homebrew.

You'll need to build Emacs with DBus support to actually use DBus. On OS X, that's rather unusual, and I can't see what you'd want to use DBus support in Emacs for, given that nothing else uses DBus on OS X.
If you're just after notifications, though, you don't need DBus. In fact, DBus won't give you notifications on OS X.
For notifications on OS X with notify.el, you need Growl. Namely, you must purchase Growl in the AppStore, or build it yourself, and additionally install Growlnotifier from http://growl.info/downloads.

Related

Can't start emacs (spacemacs) anymore: Invalid read syntax: Invalid byte-code object

Can someone tell me how I can recover from this error? I runs emacs 28.0.50 with spacemacs 0.300.0#28.0.50 on Ubuntu 19.10.
Here is the backtrace from emacs --debug-init
Debugger entered--Lisp error: (invalid-read-syntax "Invalid byte-code object")
read(get-file-char)
require(use-package-core)
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\306\307\310\311\312$\210\313\314!\207" [require use-package-core use-package-bind-key use-package-diminish use-package-delight use-package-ensure autoload use-package-jump-to-package-form "use-package-jump" nil t provide use-package] 5)
require(use-package)
spacemacs-bootstrap/init-use-package()
funcall(spacemacs-bootstrap/init-use-package)
(let* ((pkg-name (eieio-oref pkg ':name)) (owner (car (eieio-oref pkg ':owners)))) (spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner)) (funcall (intern (format "%S/init-%S" owner pkg-name))))
configuration-layer//configure-package(#<cfgl-package cfgl-package-15636ced90d0>)
mapc(configuration-layer//configure-package (#<cfgl-package cfgl-package-15636ced6330> #<cfgl-package cfgl-package-15636ced7678> #<cfgl-package cfgl-package-15636ceccf10> #<cfgl-package cfgl-package-15636ced78e4> #<cfgl-package cfgl-package-15636ced7b48> #<cfgl-package cfgl-package-15636ced7db0> #<cfgl-package cfgl-package-15636ced90d0> #<cfgl-package cfgl-package-15636ced9340>))
(let (packages-to-configure) (let ((--dolist-tail-- packages) pkg-name) (while --dolist-tail-- (setq pkg-name (car --dolist-tail--)) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg ':lazy-install) (spacemacs-buffer/message (format "%S ignored since it can be lazily installed." pkg-name))) ((and (eieio-oref pkg ...) (not ...)) (spacemacs-buffer/message (format "%S ignored since it has been excluded." pkg-name))) ((null (eieio-oref pkg ...)) (spacemacs-buffer/message (format "%S ignored since it has no owner layer." pkg-name))) ((not (configuration-layer//package-reqs-used-p pkg)) (spacemacs-buffer/message (format ... pkg-name))) ((not (cfgl-package-enabled-p pkg)) (spacemacs-buffer/message (format "%S is disabled." pkg-name))) (t (let (...) (if dir ...)) (if (memq ... ...) nil (configuration-layer//activate-package pkg-name)) (cond (... ...) (t ... ...))))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (setq packages-to-configure (reverse packages-to-configure)) (mapc 'configuration-layer//configure-package packages-to-configure) (mapc 'configuration-layer//post-configure-package packages-to-configure))
configuration-layer//configure-packages-2((async bind-key bind-map diminish evil hydra use-package which-key))
configuration-layer//configure-packages((abbrev ac-ispell academic-phrases ace-jump-helm-line ace-link ace-window add-node-modules-path aggressive-indent all-the-icons all-the-icons-dired amx anaconda-mode anki-editor ansi-colors archive-mode async attrap auctex auctex-latexmk auto-compile auto-complete auto-correct auto-dim-other-buffers auto-highlight-symbol auto-yasnippet avy beacon biblio biblio-core bibtex bind-key bind-map blacken bnf-mode bookmark bracketed-paste bug-hunter calendar calibre-mode camcorder centered-cursor-mode cheat-sh chronometer clean-aindent-mode cloc cmm-mode color-identifiers-mode column-enforce-mode comint command-log-mode ...))
configuration-layer//load()
(cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line, " "forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading p...")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!"))))))
configuration-layer/load()
(let ((file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start)))))
(if (not (version<= spacemacs-emacs-min-version emacs-version)) (error (concat "Your version of Emacs (%s) is too old. " "Spacemacs requires Emacs version %s or above.") emacs-version spacemacs-emacs-min-version) (let ((file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start))))))
eval-buffer(#<buffer *load*-45090> nil "/home/chriad/.dotfiles/emacs.d/init.el" nil t) ; Reading at buffer position 1880
load-with-code-conversion("/home/chriad/.dotfiles/emacs.d/init.el" "/home/chriad/.dotfiles/emacs.d/init.el" nil nil)
load("/home/chriad/.dotfiles/emacs.d/init.el")
(let* ((emacs-directory (file-name-as-directory (chemacs-emacs-profile-key 'user-emacs-directory))) (init-file (expand-file-name "init.el" emacs-directory)) (custom-file- (chemacs-emacs-profile-key 'custom-file init-file)) (server-name- (chemacs-emacs-profile-key 'server-name))) (setq user-emacs-directory emacs-directory) (if server-name- (progn (setq server-name server-name-))) (mapcar #'(lambda (env) (setenv (car env) (cdr env))) (chemacs-emacs-profile-key 'env)) (if (chemacs-emacs-profile-key 'straight-p) (progn (chemacs-load-straight))) (load init-file) (if (not custom-file) (progn (setq custom-file custom-file-) (if (equal custom-file init-file) nil (load custom-file)))))
chemacs-load-profile("default")
(if args (let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda ...))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))) (chemacs-load-profile (chemacs-detect-default-profile)))
chemacs-check-command-line-args(nil)
(cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda (_)))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))
(let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda (_)))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args)))))
(if args (let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda ...))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))) (chemacs-load-profile (chemacs-detect-default-profile)))
chemacs-check-command-line-args(("emacs"))
eval-buffer(#<buffer *load*> nil "/home/chriad/.emacs" nil t) ; Reading at buffer position 7021
load-with-code-conversion("/home/chriad/.emacs" "/home/chriad/.emacs" t t)
load("~/.emacs" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode 0x2bc902d994a710f>) #f(compiled-function () #<bytecode 0x81a386fa1b19353>) t)
command-line()
normal-top-level()
I had the same issue this morning.
I'm using emacs 28.0.50 on Kubuntu 19.10.
My issue was gone by deleting use-package:
rm -rf ~/.emacs.d/elpa/use-package-*
# if using the `develop` branch:
# rm -rf ~/.emacs.d/elpa/<your emacs version>/develop/use-package-*
and re-installing it:
emacs -q
eval:
(progn
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
(package-install 'use-package)
(require 'use-package)
)
For me it was a matter of doing "M-x reinstall-package RET use-package RET" and restarting Emacs.
Reinstalling use-package via the list-packages UI worked for me.
(Delete use-package, install it again)
I did not see a re-install option there.
Thank you for the hints here.
I received almost exactly the same error (emacs 28.0.50 with spacemacs 0.200.13#28.0.50 on Ubuntu 18.04). I updated the emacs packages and the problem disappeared. If I had any better ideas (or explanations) I would include them but that's all I got. Good luck!

Emacs keyboard macro fails to invoke org-mode capture template

I am trying to use the following keyboard test macro
(fset 'jj [?\C-c ?c ?t ?j ?j return ?\C-c ?\C-c])
to invoke this capture template definition
(setq org-capture-templates '(("t" "Todo" entry (file "~/org/j.org"))))
Note that C-c c invokes M-x org-capture.
Unfortunately, it produces the following error message:
After 0 kbd macro
iterations: byte-code: Capture abort: (wrong-type-argument stringp
(file:~/org/todo.org::*Tasks Tasks))
I have produced the backtrace show below. The org-mode configuration is
appended after the backtrace.
Debugger entered--Lisp error:
(error "Capture abort: (wrong-type-argument stringp
(file:~/org/todo.org::*Tasks Tasks))")
signal(error ("Capture abort: (wrong-type-argument stringp
(file:~/org/todo.org::*Tasks Tasks))"))
error("Capture abort: %s" (wrong-type-argument stringp
("file:~/org/todo.org::*Tasks" "Tasks")))
(condition-case error (org-capture-put :template
(org-capture-fill-template)) ((error quit) (if (get-buffer "*Capture*")
(kill-buffer "*Capture*")) (error "Capture abort: %s" error)))
(cond ((equal entry "C") (customize-variable (quote org-capture-templates)))
((equal entry "q") (error "Abort"))
(t (org-capture-set-plist entry) (org-capture-get-template)
(org-capture-put :original-buffer orig-buf
:original-file (or (buffer-file-name orig-buf)
(and (featurep (quote dired))
(car (rassq orig-buf
dired-buffers))))
:original-file-nondirectory (and (buffer-file-name
orig-buf) (file-name-nondirectory
(buffer-file-name orig-buf)))
:annotation annotation :initial initial
:return-to-wconf (current-window-configuration)
:default-time (or org-overriding-default-time
(org-current-time))$)
(org-capture-set-target-location)
(condition-case error
(org-capture-put :template (org-capture-fill-template))
((error quit)
(if (get-buffer "*Capture*") (kill-buffer "*Capture*"))
(error "Capture abort: %s" error)))
(setq org-capture-clock-keep (org-capture-get :clock-keep))
(if (equal goto 0)
(org-capture-insert-template-here)
(condition-case error
(org-capture-place-template
(equal (car (org-capture-get :target)) (quote function)))
((error quit) (if (and (buffer-base-buffer ...)
(string-match "\\`CAPTURE-" ...))
(kill-buffer (current-buffer)))
(set-window-configuration (org-capture-get :return-to-wconf))
(error "Capture template `%s': %s" (org-capture-get :key) (nth
1 error))))
(if (and (derived-mode-p (quote org-mode))
(org-capture-get :clock-in))
(condition-case nil (progn (if (org-clock-is-active)
(org-capture-put
:interrupted-clock...))
(org-clock-in) (org-set-local
(quote org-capture-clock-was-started) t))
(error "Could not start the clock in this capture buffer")))
(if (org-capture-get :immediate-finish) (org-capture-finalize)))))
(let* ((orig-buf (current-buffer))
(annotation
(if (and (boundp (quote org-capture-link-is-already-stored))
org-capture-link-is-already-stored)
(plist-get org-store-link-plist :annotation)
(condition-case nil (progn (org-store-link nil))
(error nil))))
(entry (or org-capture-entry (org-capture-select-template keys)))
initial)
(setq initial (or org-capture-initial (and (org-region-active-p)
(buffer-substring (point) (mark)))))
(if (stringp initial) (progn (remove-text-properties 0 (length initial)
(quote (read-only t)) initial)))
(if (stringp annotation) (progn (remove-text-properties 0 (length annotation)
(quote (read-only t)) annotation)))
(cond ((equal entry "C")
(customize-variable (quote org-capture-templates)))
((equal entry "q")
(error "Abort")) (t (org-capture-set-plist entry)
(org-capture-get-template)
(org-capture-put
:original-buffer orig-buf
:original-file (or (buffer-file-name orig-buf)
(and (featurep (quote dired))
(car (rassq orig-buf
dired-buffers))))
:original-file-nondirectory (and
(buffer-file-name orig-buf)
(file-name-nondirectory
(buffer-file-name orig-buf)))
:annotation annotation :initial initial
:return-to-wconf
(current-window-configuration)
:default-time (or org-overriding-default-time
(org-current-time)))
(org-capture-set-target-location)
(condition-case error
(org-capture-put :template
(org-capture-fill-template))
((error quit)
(if (get-buffer "*Capture*")
(kill-buffer "*Capture*"))
(error "Capture abort: %s" error)))
(setq org-capture-clock-keep (org-capture-get
:clock-keep))
(if (equal goto 0)
(org-capture-insert-template-here)
(condition-case error
(org-capture-place-template (equal (car ...) (quote function)))
((error quit) (if (and ... ...)
(kill-buffer ...))
(set-window-configuration (org-capture-get
:return-to-wconf))
(error "Capture template `%s': %s"
(org-capture-get :key) (nth 1 error))))
(if (and (derived-mode-p (quote org-mode))
(org-capture-get :clock-in))
(condition-case nil (progn (if ... ...)
(org-clock-in) (org-set-local ... t))
(error "Could not start the clock in
this capture buffer")))
(if (org-capture-get :immediate-finish)
(org-capture-finalize))))))
(cond ((equal goto (quote (4))) (org-capture-goto-target))
((equal goto (quote (16))) (org-capture-goto-last-stored))
(t (let* ((orig-buf (current-buffer))
(annotation (if (and (boundp ...)
org-capture-link-is-already-stored)
(plist-get org-store-link-plist :annotation)
(condition-case nil (progn ...) (error nil))))
(entry (or org-capture-entry
(org-capture-select-template keys))) initial)
(setq initial (or org-capture-initial
(and (org-region-active-p)
(buffer-substring (point) (mark)))))
(if (stringp initial)
(progn
(remove-text-properties 0 (length initial)
(quote (read-only t)) initial)))
(if (stringp annotation)
(progn (remove-text-properties 0 (length annotation)
(quote (read-only t))
annotation)))
(cond ((equal entry "C") (customize-variable (quote
org-capture-templates)))
((equal entry "q")
(error "Abort"))
(t (org-capture-set-plist entry) (org-capture-get-template)
(org-capture-put
:original-buffer orig-buf
:original-file (or (buffer-file-name orig-buf) (and ...
...))
:original-file-nondirectory (and (buffer-file-name
orig-buf) (file-name-nondirectory ...))
:annotation annotation
:initial initial
:return-to-wconf (current-window-configuration)
:default-time (or org-overriding-default-time
(org-current-time)))
(org-capture-set-target-location)
(condition-case error (org-capture-put
:template
(org-capture-fill-template))
((error quit) (if ... ...)
(error "Capture abort: %s" error)))
(setq org-capture-clock-keep
(org-capture-get :clock-keep))
(if (equal goto 0)
(org-capture-insert-template-here)
(condition-case error (org-capture-place-template ...)
(... ... ... ...))
(if (and ... ...) (condition-case nil ... ...))
(if (org-capture-get :immediate-finish)
(org-capture-finalize))))))))
org-capture(nil)
call-interactively(org-capture nil nil)
command-execute(jj record)
execute-extended-command(nil "jj")
call-interactively(execute-extended-command nil nil)
----------------------------------------------------
ORG-MODE CONFIGURATION
Emacs : GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2)
of 2014-02-22 on chindi10, modified by Debian
Package: Org-mode version 8.2.10 (8.2.10-dist <at> /usr/share/emacs/site-lisp/org/)
current state:
==============
(setq
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-agenda-use-time-grid nil
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-hide-inline-tasks org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-agenda-custom-commands '(("pa" "A-priority" tags-todo
"+SCHEDULED<=\"<today>\"+PRIORITY=\"A\"") ("pb" "B-priority"
tags-todo
"+SCHEDULED<=\"<today>\"+PRIORITY=\"B\"")
("pc" "C-priority" tags-todo
"+SCHEDULED<=\"<today>\"+PRIORITY=\"C\"") ("b" "Buy" tags
"+CATEGORY=\"BUY\"")
("w" "Web" tags "+CATEGORY=\"WEB\"") ("k"
"Books" tags "+CATEGORY=\"BOOKS\"")
("v" "Movies" tags "+CATEGORY=\"MOVIES\"")
("u" "Music" tags "+CATEGORY=\"MUSIC\""))
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-babel-pre-tangle-hook '(save-buffer)
org-occur-hook '(org-first-headline-recenter)
org-deadline-warning-days 0
org-metaup-hook '(org-babel-load-in-session-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-capture-templates '(("t" "Todo" entry (file "~/org/j.org")))
org-agenda-sorting-strategy '((agenda priority-down) (todo priority-down
category-keep) (tags priority-down category-keep) (search category-keep))
org-agenda-start-with-follow-mode t
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-agenda-prefix-format " %-11:c% s"
org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook
change-major-mode-hook org-show-block-all append local]
5]
#[nil "\300\301\302\303\304$\207" [org-add-hook
change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes my-org-mode-hook)
org-agenda-start-on-weekday nil
org-agenda-mode-hook '(my-org-agenda-mode-hook)
org-directory "~/org/"
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-agenda-files '("~/org/todo.org" "~/org/home.org")
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-confirm-shell-link-function 'yes-or-no-p
)
Short: executing-kbd-macro in org-store-link is the reason. I couldn't come up with a simple solution.
I tried to reproduce this error and found that function
(defun test-inside-kbd-macro ()
(interactive)
(print (ignore-errors (org-store-link nil))))
gives different results depending on way to run. 1) M-x test-inside-kbd-macro
gives "[[file:~/git/org/refile.org::*kbd%20capture][kbd capture]]" (string), but 2)
(execute-kbd-macro (read-kbd-macro "M-x test-inside-kbd-macro RET"))
gives ("file:~/git/org/refile.org::*kbd capture" "kbd capture") (list). So the error (wrong-type-argument stringp ...) occurs due to this.
If you see code of the function org-store-link(the last 10 lines)
;; Return the link
(if (not (and (or (org-called-interactively-p 'any)
executing-kbd-macro) link))
(or agenda-link (and link (org-make-link-string link desc)))
(push (list link desc) org-stored-links)
(message "Stored: %s" (or desc link))
(when custom-id
(setq link (concat "file:" (abbreviate-file-name
(buffer-file-name)) "::#" custom-id))
(push (list link desc) org-stored-links))
(car org-stored-links))))))
you will find that in the 1) case the value of the function test-inside-kbd-macro is created using (org-make-link-string link desc) and in the 2) case - using (car org-stored-links).
I think this is due to executing-kbd-macro in if section.
org-capture:
annotation -> (ignore-errors (org-store-link nil))
(org-capture-put ...
:annotation annotation ...)
org-capture-fill-template:
(v-a (or (plist-get org-store-link-plist :annotation)
annotation
(org-capture-get :annotation)
""))
(v-A (if (and v-a (string-match l-re v-a))
generates the error.

How to use a cons cell to define and later remove overlays with `dolist`

I am looking for some guidance, please, to reduce the time needed to perform my custom overlay removal function. The delay of up to 0.1 seconds is caused because a plethora of variables all have values, however, not every variable is necessarily used.
My goal is to attach a second variable that can be set to non-nil whenever the first variable is used, but I am unsure how to set this up and how to incorporate that into the overlay removal function.
Perhaps something that looks like this would be useful:
if (variable-one . t), then (remove-overlays (point-min) (point-max) 'display character)
In the following example, M-x sub-char-mode will place an overlay over the characters 1, 2 or 3 whenever the cursor is visiting any of those characters:
1 will become |1
2 will become |2
3 will become |3
(defvar variable-one (concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "1" 'face 'highlight 'cursor t) ))
(defvar variable-one-p (cons variable-one nil))
(defvar variable-two (concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "2" 'face 'highlight 'cursor t) ))
(defvar variable-two-p (cons variable-two nil))
(defvar variable-three (concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "3" 'face 'highlight 'cursor t) ))
(defvar variable-three-p (cons variable-three nil))
(defun substitute-character ()
(cond
((eq (char-after (point)) 49)
(setq variable-one-p (cons variable-one t))
(overlay-put (make-overlay (point) (1+ (point))) 'display variable-one))
((eq (char-after (point)) 50)
(setq variable-two-p (cons variable-two t))
(overlay-put (make-overlay (point) (1+ (point))) 'display variable-two))
((eq (char-after (point)) 51)
(setq variable-three-p (cons variable-three t))
(overlay-put (make-overlay (point) (1+ (point))) 'display variable-three))))
(defun remove-sub-char ()
(dolist (character `(
,variable-one
,variable-two
,variable-three))
(remove-overlays (point-min) (point-max) 'display character))
(dolist (my-variable `(
,variable-one-p
,variable-two-p
,variable-three-p))
(setq my-variable nil)) )
(defun sub-char-post-command-hook ()
(remove-sub-char)
(substitute-character))
(define-minor-mode sub-char-mode
"A minor-mode for testing overlay-removal with cons cells."
:init-value nil
:lighter " OV-REMOVE"
:keymap nil
:global nil
:group 'lawlist
(cond
(sub-char-mode
(add-hook 'post-command-hook 'sub-char-post-command-hook nil t)
(message "Turned ON `sub-char-mode`."))
(t
(remove-hook 'post-command-hook 'sub-char-post-command-hook t)
(remove-sub-char)
(message "Turned OFF `sub-char-mode`."))))
Apologies for pasting this image here - feel free to remove it. But I couldn't paste it into a comment, to reply to your comment asking for the appearance. This is vline-style = compose and col-highlight-vline-face-flag = nil:
First Draft (August 24, 2014):  The first draft answer defines the variables as a cons cell -- the car is a predetermined overlay string, and the cdr is nil. When the cursor visits the characters 1, 2 or 3, an overlay is placed on top of those characters and the cdr of the applicable cons cell is set to t by using setcdr. The overlay removal function contains a list of variable names and the corresponding cons cells -- when the cdr of the cons cell is non-nil (i.e., t), the overlay is removed, and the cdr of the applicable cons cell is set back to nil using setcdr. The advantage of this type of setup is that the overlay removal function will quickly look at and then skip over variables whose cons cell cdr is nil -- thus saving a substantial amount of time when dealing with large quantities of variables with predetermined overlay strings.
EDIT (August 26, 2014):  Modified code to permit using the same variable names in different buffers and set buffer-local values. Related threads are: How to use `setcdr` with buffer-local variables and Incorporate variable name into `dolist` cycle and change its value .
(defvar variable-one
(cons
(concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "1" 'face 'highlight 'cursor t) )
nil))
(make-variable-buffer-local 'variable-one)
(defvar variable-two
(cons
(concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "2" 'face 'highlight 'cursor t) )
nil))
(make-variable-buffer-local 'variable-two)
(defvar variable-three
(cons
(concat
(propertize (char-to-string ?\u007C)
'face 'font-lock-warning-face
'cursor t)
(propertize "3" 'face 'highlight 'cursor t) )
nil))
(make-variable-buffer-local 'variable-three)
(defun sub-char ()
(cond
((eq (char-after (point)) 49)
(let ((newlist (copy-list variable-one)))
(setcdr newlist t)
(setq-local variable-one newlist)
(overlay-put (make-overlay (point) (1+ (point))) 'display (car variable-one))))
((eq (char-after (point)) 50)
(let ((newlist (copy-list variable-two)))
(setcdr newlist t)
(setq-local variable-two newlist)
(overlay-put (make-overlay (point) (1+ (point))) 'display (car variable-two))))
((eq (char-after (point)) 51)
(let ((newlist (copy-list variable-three)))
(setcdr newlist t)
(setq-local variable-three newlist)
(overlay-put (make-overlay (point) (1+ (point))) 'display (car variable-three))))))
(defun remove-sub-char ()
(dolist (character `(
(variable-one ,variable-one)
(variable-two ,variable-two)
(variable-three ,variable-three)))
(when (cdr (car (cdr character)))
(let* (
(var (car character))
(newlist (copy-list (car (cdr character)))) )
(remove-overlays (point-min) (point-max) 'display (car (car (cdr character))))
(setcdr newlist nil)
(set (car character) newlist)
(message "var1: %s | var2: %s | var3: %s" variable-one variable-two variable-three) ))))
(defun sub-char-post-command-hook ()
(remove-sub-char)
(sub-char))
(define-minor-mode sub-char-mode
"A minor-mode for testing overlay-removal with cons cells."
:init-value nil
:lighter " OV-REMOVE"
:keymap nil
:global nil
:group 'lawlist
(cond
(sub-char-mode
(add-hook 'post-command-hook 'sub-char-post-command-hook nil t)
(message "Turned ON `sub-char-mode`."))
(t
(remove-hook 'post-command-hook 'sub-char-post-command-hook t)
(remove-sub-char)
(message "Turned OFF `sub-char-mode`."))))
I suggest you start by getting rid of your variable-FOO-p vars: not only their names are wrong (the "-p" suffix is meant for use with predicates which are necessarily functions, and not variables) but they're unneeded. Rather than tell remove-overlays to remove all overlays with a particular display property, just add a property of your own (e.g. (overlay-put <youroverlay> 'vline t)) so you can then do a single (remove-overlays (point-min) (point-max) 'vline t). Of course, another approach which will work at least as well is to keep a single buffer-local variable (better yet, window-local) which holds a list of all the overlays you currently have placed. This way, you can remove those overlays with a single (mapc #'delete-overlay vline--overlays), which is more efficient. It can be made even more efficient by moving/reusing those overlays rather than deleting them and then creating new ones instead.

How to view man page using Info in Emacs?

I can view man pages using info in the terminal:
info pthread_create
However, it is not possible with info in Emacs, even with info-apropos or info-menu.
EDIT:
It seems that fall-backs are not in the concept of Info-mode.
There follows a work-around applying advice. It does not work perfect but around the missing feature ;-).
It defines a fall-back for Info-goto-node (in Info-mode bound to g) and for Info-menu (in Info-mode bound to m).
Furthermore, it adds manual-apropos to info-apropos.
(require 'woman)
(defun Info-man-completion (_caller _info string predicate action)
"Add man entries to info completion."
;; prepare woman:
(unless (and woman-expanded-directory-path woman-topic-all-completions)
(setq woman-expanded-directory-path
(woman-expand-directory-path woman-manpath woman-path)
woman-topic-all-completions
(woman-topic-all-completions woman-expanded-directory-path)))
;; do completions:
(cond
((null action) ;; try-completion
;; shortest wins
(let ((_man (try-completion string woman-topic-all-completions)))
(cond
((eq _info t)
t)
((eq _man t)
t)
((and (stringp _info) (stringp _man))
(if (> (length _info) (length _man))
_man
_info))
((stringp _info)
_info)
(t _man)
)))
((eq action t) ;; all-completions
(let ((_man (all-completions string woman-topic-all-completions)))
(append _info _man)
))
((eq action 'lambda) ;; test-completion
(try-completion string _caller))
((eq action 'metadata) ;; state of current completion
'(metadata) ;; no specification
)))
;; args: string predicate code
(defadvice Info-read-node-name-1 (around man activate)
"Add man entries to info completion."
(setq ad-return-value (apply 'Info-man-completion 'Info-read-node-name-1 ad-do-it (ad-get-args 0))))
;;
(defadvice Info-complete-menu-item (around man activate)
"Add man entries to info completion."
(setq ad-return-value (apply 'Info-man-completion 'Info-complete-menu-item ad-do-it (ad-get-args 0))))
(defadvice Info-goto-node (around man activate)
"If no info node is found for string lookup and show man entry."
(condition-case err
ad-do-it
(user-error
(let ((err-str (car-safe (cdr err))))
(if (and (stringp err-str)
(string-match "No such node or anchor:" err-str))
(man (ad-get-arg 0))
(signal 'user-error err-str)
)))))
(defadvice Info-menu (around man activate)
"If no info menu entry is found for string lookup and show man entry."
(condition-case err
ad-do-it
(user-error
(let ((err-str (car-safe (cdr err))))
(if (and (stringp err-str)
(string-match "No such item in menu" err-str))
(man (ad-get-arg 0))
(signal 'user-error err-str)
)))))
(defadvice Info-apropos-find-node (after man activate)
"Add man appropos to info appropos."
(let (item)
(goto-char (point-max))
(let ((inhibit-read-only t))
(insert "\nMatches found by man-apropos\n\n")
(let ((beg (point))
(nodeinfo (assoc nodename Info-apropos-nodes)))
(if nodeinfo
(let ((search-string (nth 1 nodeinfo)))
(call-process "apropos" nil t t search-string)
(goto-char beg)
(while (re-search-forward "^\\(\\(?:[[:alnum:]]\\|\\s_\\)+\\)\\(?:[[:blank:]]+\\[\\]\\)?\\([[:blank:]]+([[:alnum:]]+)\\)[[:blank:]]+-[[:blank:]]+\\(.*\\)$" nil t)
(replace-match (replace-regexp-in-string "\\\\" "\\\\\\\\" (format "* %-38s.%s"
(format "%s:" (match-string 1))
(concat (match-string 1) (match-string 2))
(match-string 3))))))
(man nodename)
)))))
Info gives an error that the node is not available. Thereafter, the manual page is shown if there is one.
[Edited]
EmacsWiki says that iman:
Opens either an info format manual with InfoMode or a man page with
ManMode.
It links to the author's website:
http://homepage1.nifty.com/bmonkey/emacs/elisp/iman.el
Found M-x woman MANPAGE RET to most convenient way to call manpages from inside Emacs.

In emacs, can I set up the *Messages* buffer so that it tails?

Basically I want the *Messages* buffer to always scroll to the bottom when a new message arrives.
Can I do that?
I found auto-revert-tail-mode but that works for buffers that are visiting files.
When I tried it in the Messages buffer, it popped an error:
auto-revert-tail-mode: This buffer is not visiting a file
For multiple frames you probably want:
(defadvice message (after message-tail activate)
"goto point max after a message"
(with-current-buffer "*Messages*"
(goto-char (point-max))
(walk-windows (lambda (window)
(if (string-equal (buffer-name (window-buffer window)) "*Messages*")
(set-window-point window (point-max))))
nil
t)))
Just put point at the end of the buffer M->. If you don't manually move it it will stay there -- IOW, you will always see the tail.
This code seems a bit overkill, but a the simple (goto-char (point-max)) wasn't working for me:
(defadvice message (after message-tail activate)
"goto point max after a message"
(with-current-buffer "*Messages*"
(goto-char (point-max))
(let ((windows (get-buffer-window-list (current-buffer) nil t)))
(while windows
(set-window-point (car windows) (point-max))
(setq windows (cdr windows))))))
Here's an implementation that uses the new advice style.
(defun message-buffer-goto-end-of-buffer (&rest args)
(let* ((win (get-buffer-window "*Messages*"))
(buf (and win (window-buffer win))))
(and win (not (equal (current-buffer) buf))
(set-window-point
win (with-current-buffer buf (point-max))))))
(advice-add 'message :after 'message-buffer-goto-end-of-buffer)
i run 23.3 and there were still way too many occasions where the built-in 'solution' and the orginal defadvice on the message function just didn't cut it, so i wrapped that code in a list / toggle / timer set up and it's working beautifully - no more frustration when debugging!
it's generic, so works on any buffer, although i only really use it for..
(toggle-buffer-tail "*Messages*" "on")
..hope it's useful to someone.
;alist of 'buffer-name / timer' items
(defvar buffer-tail-alist nil)
(defun buffer-tail (name)
"follow buffer tails"
(cond ((or (equal (buffer-name (current-buffer)) name)
(string-match "^ \\*Minibuf.*?\\*$" (buffer-name (current-buffer)))))
((get-buffer name)
(with-current-buffer (get-buffer name)
(goto-char (point-max))
(let ((windows (get-buffer-window-list (current-buffer) nil t)))
(while windows (set-window-point (car windows) (point-max))
(with-selected-window (car windows) (recenter -3)) (setq windows (cdr windows))))))))
(defun toggle-buffer-tail (name &optional force)
"toggle tailing of buffer NAME. when called non-interactively, a FORCE arg of 'on' or 'off' can be used to to ensure a given state for buffer NAME"
(interactive (list (cond ((if name name) (read-from-minibuffer
(concat "buffer name to tail"
(if buffer-tail-alist (concat " (" (caar buffer-tail-alist) ")") "") ": ")
(if buffer-tail-alist (caar buffer-tail-alist)) nil nil
(mapcar '(lambda (x) (car x)) buffer-tail-alist)
(if buffer-tail-alist (caar buffer-tail-alist)))) nil)))
(let ((toggle (cond (force force) ((assoc name buffer-tail-alist) "off") (t "on")) ))
(if (not (or (equal toggle "on") (equal toggle "off")))
(error "invalid 'force' arg. required 'on'/'off'")
(progn
(while (assoc name buffer-tail-alist)
(cancel-timer (cdr (assoc name buffer-tail-alist)))
(setq buffer-tail-alist (remove* name buffer-tail-alist :key 'car :test 'equal)))
(if (equal toggle "on")
(add-to-list 'buffer-tail-alist (cons name (run-at-time t 1 'buffer-tail name))))
(message "toggled 'tail buffer' for '%s' %s" name toggle)))))
edit: changed functionality to display tail at the bottom of the window
Here's an amendment over Peter's / Trey's solutions
(defun modi/messages-auto-tail (&rest _)
"Make *Messages* buffer auto-scroll to the end after each message."
(let* ((buf-name "*Messages*")
;; Create *Messages* buffer if it does not exist
(buf (get-buffer-create buf-name)))
;; Activate this advice only if the point is _not_ in the *Messages* buffer
;; to begin with. This condition is required; otherwise you will not be
;; able to use `isearch' and other stuff within the *Messages* buffer as
;; the point will keep moving to the end of buffer :P
(when (not (string= buf-name (buffer-name)))
;; Go to the end of buffer in all *Messages* buffer windows that are
;; *live* (`get-buffer-window-list' returns a list of only live windows).
(dolist (win (get-buffer-window-list buf-name nil :all-frames))
(with-selected-window win
(goto-char (point-max))))
;; Go to the end of the *Messages* buffer even if it is not in one of
;; the live windows.
(with-current-buffer buf
(goto-char (point-max))))))
(advice-add 'message :after #'modi/messages-auto-tail)