How to fix company-mode autocompletion for executables? - emacs

I've started using doom-emacs recently with company-mode enabled.
When I autocomplete an executable (./progr[ENTER]) in eshell it removes the "./" i.e.: I get "program" instead of "./program" on my command line.
When I launch that line, I get the message: "Wrong type argument: sequencep, 771".
Any clue what's going on / how I can fix it?
Thanks!
--- stacktrace ---
with toggle-debug-on-error enabled:
error("%s: command not found" "program")
eshell-find-interpreter("program" nil nil)
eshell-external-command("program" nil)
eshell-plain-command("program" nil)
eshell-named-command("program")
eval((eshell-named-command '"program"))
eshell-do-eval((eshell-named-command '"program") nil)
eshell-do-eval((prog1 (eshell-named-command '"program") (mapc #'funcall eshell-this-command-hook)) nil)
(condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"program") (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))
eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"program") (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))
eshell-do-eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"program") (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))) nil)
#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>)()
funcall(#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>))
(let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>)))
eval((let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>))))
eshell-do-eval((let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"program") (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))) nil)
eshell-do-eval((progn (let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command ...) (mapc ... eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))) nil)
(catch 'top-level (eshell-do-eval '(progn (let ((eshell-this-command-hook '...)) (condition-case err (eshell-do-eval '... nil) ((debug error) (mapc ... eshell-this-command-hook) (eshell-errorn ...) (eshell-close-handles 1))))) nil))
eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-this-command-hook ...)) (condition-case err (eshell-do-eval ... nil) (... ... ... ...)))) nil)))
eshell-do-eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-this-command-hook ...)) (condition-case err (eshell-do-eval ... nil) (... ... ... ...)))) nil)) nil)
eshell-do-eval((progn 'nil (catch 'top-level (eshell-do-eval '(progn (let (...) (condition-case err ... ...))) nil)) (run-hooks 'eshell-post-command-hook)) nil)
#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>)()
funcall(#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>))
(let ((eshell-current-handles '[nil (t . 1) (t . 1)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>)))
eval((let ((eshell-current-handles '[nil (t . 1) (t . 1)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode -0x13dc3821b05c18d2>))))
eshell-do-eval((let ((eshell-current-handles '[nil (t . 1) (t . 1)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook))))
eshell-resume-eval()
eshell-eval-command((let ((eshell-current-handles '[nil (t . 1) (t . 1)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook))) "program")
eshell-send-input(nil)
funcall-interactively(eshell-send-input nil)
command-execute(eshell-send-input)

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.

Emacs -- How to extract all elements of a list

I am looking for some assistance, please, to extract all elements of a list of files and/or directories that have been marked in dired-mode. Essentially, if there were some way to just remove the parentheses from around the result of (mapcar (lambda (filename) (file-name-nondirectory filename)) (dired-get-marked-files)), then that would do the trick.
(start-process
"name-of-process"
"*output-buffer*"
"/usr/bin/zip"
"zip-file-name.zip"
(mapcar
(lambda (filename) (file-name-nondirectory filename))
(dired-get-marked-files)) )
The result I am seeking will look like this:
(start-process
"name-of-process"
"*output-buffer*"
"/usr/bin/zip"
"zip-file-name.zip"
"filename-number-one"
"filename-number-two"
"filename-number-three" )
EDIT:
The start-process function does not generally accept a single concatenated string of arguments. Instead, each argument must be separately spelled out (with quotation marks around each argument), or the argument can be a variable.
Here is the debugger message from the first example above -- the error occurs because there is a parentheses around the file names -- i.e., it cannot be a list.
Debugger entered--Lisp error: (wrong-type-argument stringp ("file-name-number-one" "file-name-number-two" "file-name-number-three"))
start-process("name-of-process" "*output-buffer*" "/usr/bin/zip" "zip-file-name.zip" ("file-name-number-one" "file-name-number-two" "file-name-number-three"))
eval((start-process "name-of-process" "*output-buffer*" "/usr/bin/zip" "zip-file-name.zip" (mapcar (lambda (filename) (file-name-nondirectory filename)) (dired-get-marked-files))) nil)
(cons (eval exp lexical-binding) values)
(setq values (cons (eval exp lexical-binding) values))
(let ((debug-on-error old-value)) (setq values (cons (eval exp lexical-binding) values)) (setq new-value debug-on-error))
(let ((old-value (make-symbol "t")) new-value) (let ((debug-on-error old-value)) (setq values (cons (eval exp lexical-binding) values)) (setq new-value debug-on-error)) (if (eq old-value new-value) nil (setq debug-on-error new-value)))
(if (null eval-expression-debug-on-error) (setq values (cons (eval exp lexical-binding) values)) (let ((old-value (make-symbol "t")) new-value) (let ((debug-on-error old-value)) (setq values (cons (eval exp lexical-binding) values)) (setq new-value debug-on-error)) (if (eq old-value new-value) nil (setq debug-on-error new-value))))
(let ((exp (if exp exp (read--expression "Eval: ")))) (if (null eval-expression-debug-on-error) (setq values (cons (eval exp lexical-binding) values)) (let ((old-value (make-symbol "t")) new-value) (let ((debug-on-error old-value)) (setq values (cons (eval exp lexical-binding) values)) (setq new-value debug-on-error)) (if (eq old-value new-value) nil (setq debug-on-error new-value)))) (let ((print-length (and (not (= 0 (prefix-numeric-value insert-value))) eval-expression-print-length)) (print-level (and (not (= 0 (prefix-numeric-value insert-value))) eval-expression-print-level)) (deactivate-mark)) (if insert-value (with-no-warnings (let ((standard-output (current-buffer))) (prog1 (prin1 (car values)) (if (= 0 ...) (progn ...))))) (prog1 (prin1 (car values) t) (let ((str (eval-expression-print-format ...))) (if str (princ str t)))))))
(if (active-minibuffer-window) nil (let ((exp (if exp exp (read--expression "Eval: ")))) (if (null eval-expression-debug-on-error) (setq values (cons (eval exp lexical-binding) values)) (let ((old-value (make-symbol "t")) new-value) (let ((debug-on-error old-value)) (setq values (cons (eval exp lexical-binding) values)) (setq new-value debug-on-error)) (if (eq old-value new-value) nil (setq debug-on-error new-value)))) (let ((print-length (and (not (= 0 ...)) eval-expression-print-length)) (print-level (and (not (= 0 ...)) eval-expression-print-level)) (deactivate-mark)) (if insert-value (with-no-warnings (let ((standard-output ...)) (prog1 (prin1 ...) (if ... ...)))) (prog1 (prin1 (car values) t) (let ((str ...)) (if str (princ str t))))))))
lawlist-eval-expression()
funcall-interactively(lawlist-eval-expression)
call-interactively(lawlist-eval-expression nil nil)
command-execute(lawlist-eval-expression)
What you want is to use apply with (mapcar ...) as its last argument:
(apply 'start-process
"name-of-process"
"*output-buffer*"
"/usr/bin/zip"
"zip-file-name.zip"
(mapcar #'file-name-nondirectory (dired-get-marked-files)))
Note that (mapcar #'function list) is a shorter spelling of (mapcar (lambda (arg) (function arg)) list).
combine-and-quote-strings is what you want:
(combine-and-quote-strings (mapcar (lambda (x)
(file-name-nondirectory x))
(dired-get-marked-files)))
EDIT: the following will give you a single, quoted string with internal quotes. Not sure if it'll play nicely with start-process:
(mapconcat
(lambda (x)
(concat "\"" (file-name-nondirectory x) "\""))
(dired-get-marked-files) " ")
EDIT: Righty-o, let's try this. Splice the backquoted list with ,#, then eval the whole thing:
(eval `(start-process
"name-of-process"
"*output-buffer*"
"/usr/bin/zip"
"zip-file-name.zip"
,#(mapcar
(lambda (x)
(file-name-nondirectory x))
(dired-get-marked-files))))

org-mode can't edit C source code

When I use emacs's org-mode to edit a C program, that is when I edit the below segment:
#+begin_src c
#define MAX 100
#+end_src
and after I call the function 'org-edit-src-code' to edit the C code in a new buffer, there is an error:
Language mode `c-mode' fails with: stringp
and I can neither save to nor return to the original buffer after I edit the code in the new buffer.
Every other languages can work without any problem, including C++, elisp, sh.
How can I fix this problem? My org-mode version is 7.6 and emacs version is 23.2.
the full debug info is (follow Noufal Ibrahim's method):
Debugger entered--Lisp error: (error "Language mode `c-mode' fails with: stringp")
signal(error ("Language mode `c-mode' fails with: stringp"))
error("Language mode `%s' fails with: %S" c-mode stringp)
(condition-case e (funcall lang-f) (error (error "Language mode `%s' fails with: %S" lang-f ...)))
(let ((org-inhibit-startup t)) (condition-case e (funcall lang-f) (error ...)))
(if (and (setq buffer ...) (if org-src-ask-before-returning-to-edit-buffer ... t)) (org-src-switch-to-buffer buffer (quote return)) (when buffer (with-current-buffer buffer ...) (kill-buffer buffer)) (setq buffer (generate-new-buffer ...)) (setq ovl (make-overlay beg end)) (overlay-put ovl (quote edit-buffer) buffer) (overlay-put ovl (quote help-echo) "Click with mouse-1 to switch to buffer editing this segment") (overlay-put ovl (quote face) (quote secondary-selection)) (overlay-put ovl (quote keymap) (let ... ... map)) (overlay-put ovl :read-only "Leave me alone") (setq transmitted-variables (append transmitted-variables ...)) (org-src-switch-to-buffer buffer (quote edit)) (if (eq single ...) (setq code ...)) (insert code) (remove-text-properties (point-min) (point-max) (quote ...)) (unless (cadr ...) (setq total-nindent ...)) (let (...) (condition-case e ... ...)) (dolist (pair transmitted-variables) (org-set-local ... ...)) (when org-mode-p (goto-char ...) (while ... ... ...)) (when markline (org-goto-line ...) (org-move-to-column ...) (push-mark ... ... t) (setq deactivate-mark nil)) (org-goto-line (1+ ...)) (org-move-to-column (if org-src-preserve-indentation col ...)) (org-src-mode) (set-buffer-modified-p nil) (and org-edit-src-persistent-message (org-set-local ... msg)) (let (...) (when ... ...)))
(if (not info) nil (setq beg (move-marker beg ...) end (move-marker end ...) msg (if allow-write-back-p ... "Exit with C-c ' (C-c and single quote)") code (or code ...) lang (or ... ...) lang (if ... ... lang) single (nth 3 info) block-nindent (nth 5 info) lang-f (intern ...) begline (save-excursion ... ...) transmitted-variables (\` ...)) (if (and mark ... ...) (save-excursion ... ...)) (if (equal lang-f ...) (setq lang-f ...)) (unless (functionp lang-f) (error "No such language mode: %s" lang-f)) (save-excursion (if ... ...) (setq line ... col ...)) (if (and ... ...) (org-src-switch-to-buffer buffer ...) (when buffer ... ...) (setq buffer ...) (setq ovl ...) (overlay-put ovl ... buffer) (overlay-put ovl ... "Click with mouse-1 to switch to buffer editing this segment") (overlay-put ovl ... ...) (overlay-put ovl ... ...) (overlay-put ovl :read-only "Leave me alone") (setq transmitted-variables ...) (org-src-switch-to-buffer buffer ...) (if ... ...) (insert code) (remove-text-properties ... ... ...) (unless ... ...) (let ... ...) (dolist ... ...) (when org-mode-p ... ...) (when markline ... ... ... ...) (org-goto-line ...) (org-move-to-column ...) (org-src-mode) (set-buffer-modified-p nil) (and org-edit-src-persistent-message ...) (let ... ...)) t)
(let ((mark ...) (case-fold-search t) (info ...) (full-info ...) (org-mode-p ...) (beg ...) (end ...) (allow-write-back-p ...) block-nindent total-nindent ovl lang lang-f single lfmt buffer msg begline markline markcol line col transmitted-variables) (if (not info) nil (setq beg ... end ... msg ... code ... lang ... lang ... single ... block-nindent ... lang-f ... begline ... transmitted-variables ...) (if ... ...) (if ... ...) (unless ... ...) (save-excursion ... ...) (if ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) t))
org-edit-src-code()
(cond ((save-excursion ... ...) (find-file ...)) ((org-edit-src-code)) ((org-edit-fixed-width-region)) ((org-at-table\.el-p) (org-edit-src-code)) ((or ... ...) (call-interactively ...)) (t (call-interactively ...)))
org-edit-special()
call-interactively(org-edit-special nil nil)
I am a novice and I don't know what the problem is. Any advice?
As discovered in the comments this is caused by accessing buffer-file-name in a temporary buffer which is not backed by a file and hence buffer-file-name is nil giving rise the it's failing stringp. Anyway, one way to fix it is by replacing instances of buffer-file-name with
(or buffer-file-name "DEFAULT-NAME")
if you need to use it, or by a block like the following
(when buffer-file-name
(code-going-here-will-only-be-executed-if-buffer-file-name-in-non-nil))
Which is easier/better will of course depend upon what you are doing.

org-read-date fails when running vimpulse

I get an error about rebinding a key sequence (see below). So I'm guessing this is because vimpulse uses the ESC key on it's own, not as a replacement for META. I've got Vimpulse disabled in the minibuffer but i still get the problem. Any ideas?
The error I get using org-read-date (with C-. for example) is "org-defkey: Key sequence ESC starts with non-prefix key ESC" and when I run it from the scratch buffer I get:
Debugger entered--Lisp error: (error "Key sequence ESC <S-left> starts with non-prefix key ESC")
define-key((keymap (M-S-down lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-up lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-right lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-left lambda nil (interactive) (org-eval-in-calendar ...)) (menu-bar keymap (minibuf "Minibuf" keymap ... ... ... ... ... ... "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (up . previous-history-element) (prior . previous-history-element) (down . next-history-element) (next . next-history-element) (27 . abort-recursive-edit)) [27 (shift left)] (lambda nil (interactive) (org-eval-in-calendar (quote ...))))
org-defkey((keymap (M-S-down lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-up lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-right lambda nil (interactive) (org-eval-in-calendar ...)) (M-S-left lambda nil (interactive) (org-eval-in-calendar ...)) (menu-bar keymap (minibuf "Minibuf" keymap ... ... ... ... ... ... "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (up . previous-history-element) (prior . previous-history-element) (down . next-history-element) (next . next-history-element) (27 . abort-recursive-edit)) [27 (shift left)] (lambda nil (interactive) (org-eval-in-calendar (quote ...))))
(let* ((old-map ...) (map ...) (minibuffer-local-map ...)) (org-defkey map (kbd "RET") (quote org-calendar-select)) (org-defkey map [mouse-1] (quote org-calendar-select-mouse)) (org-defkey map [mouse-2] (quote org-calendar-select-mouse)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [27 ...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [27 ...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [27 ...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [27 ...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map [...] (lambda nil ... ...)) (org-defkey minibuffer-local-map ">" (lambda nil ... ...)) (org-defkey minibuffer-local-map "<" (lambda nil ... ...)) (org-defkey minibuffer-local-map "" (lambda nil ... ...)) (org-defkey minibuffer-local-map "\366" (lambda nil ... ...)) (run-hooks (quote org-read-date-minibuffer-setup-hook)) (unwind-protect (progn ... ... ... ...) (remove-hook ... ...) (use-local-map old-map) (when org-read-date-overlay ... ...)))
(progn (calendar-forward-day (- ... ...)) (org-eval-in-calendar nil t) (let* (... ... ...) (org-defkey map ... ...) (org-defkey map [mouse-1] ...) (org-defkey map [mouse-2] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [27 ...] ...) (org-defkey minibuffer-local-map [27 ...] ...) (org-defkey minibuffer-local-map [27 ...] ...) (org-defkey minibuffer-local-map [27 ...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map [...] ...) (org-defkey minibuffer-local-map ">" ...) (org-defkey minibuffer-local-map "<" ...) (org-defkey minibuffer-local-map "" ...) (org-defkey minibuffer-local-map "\366" ...) (run-hooks ...) (unwind-protect ... ... ... ...)))
(unwind-protect (progn (calendar-forward-day ...) (org-eval-in-calendar nil t) (let* ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) (bury-buffer "*Calendar*"))
(save-window-excursion (calendar) (unwind-protect (progn ... ... ...) (bury-buffer "*Calendar*")))
(save-excursion (save-window-excursion (calendar) (unwind-protect ... ...)))
(cond (from-string (setq ans from-string)) (org-read-date-popup-calendar (save-excursion ...)) (t (unwind-protect ... ...)))
(let* ((org-time-stamp-rounding-minutes ...) (org-dcst org-display-custom-times) (ct ...) (def ...) (defdecode ...) (dummy ...) (calendar-frame-setup nil) (calendar-setup nil) (calendar-move-hook nil) (calendar-view-diary-initially-flag nil) (calendar-view-holidays-initially-flag nil) (timestr ...) (prompt ...) ans (org-ans0 "") org-ans1 org-ans2 final) (cond (from-string ...) (org-read-date-popup-calendar ...) (t ...)) (setq final (org-read-date-analyze ans def defdecode)) (when org-read-date-analyze-forced-year (message "Year was forced into %s" ...) (ding)) (setq final (decode-time ...)) (setq org-read-date-final-answer ans) (if to-time (apply ... final) (if ... ... ...)))
org-read-date()
eval((org-read-date))
eval-expression((org-read-date) nil)
call-interactively(eval-expression nil nil)
Yes, it sounds like something (e.g. Vim) changed ESC from a prefix key. You can perhaps just rebind the command in question (the one normally bound to ESC S-left or M-S-left) to some other key. You can probably choose to do that only when you are in Vim mode or whatever, by binding it in the appropriate Vim mode or whatever keymap.