I'm trying to install bookmarks and I get the error. When I tried byte-compiling the files it also failed. Is there a current git for bookmarks+. Error below:
Invalid function: bmkp-menu-bar-make-toggle
Here is the full trace:
Debugger entered--Lisp error: (invalid-function bmkp-menu-bar-make-toggle)
bmkp-menu-bar-make-toggle(t t "Highlight Jump using Crosshairs" "Crosshairs highlighting is %s" "Temporarily highlight visited bookmarks using crosshairs")
byte-code("\306\307\310 B#\210\306 \311\312\n\211\313\314\315%#\210\306 \316\312\211\317\320\321%#\210\306 \322\312\f\211\323\324\325%#\210\306 \326\312
\211\327\330\331%#\210\306 \332\312\211\333\334\335%#\207" [menu-bar-bookmark-map bmkp-options-menu bmkp-crosshairs-flag bmkp-bmenu-state-file bookmark-save-flag bmkp-save-new-location-flag define-key [options] "Toggle Option" [bmkp-crosshairs-flag] bmkp-menu-bar-make-toggle "Highlight Jump using Crosshairs" "Crosshairs highlighting is %s" "Temporarily highlight visited bookmarks using crosshairs" [bmkp-toggle-saving-menu-list-state] "Autosave *Bookmark List* Display State" "Autosaving of `*Bookmark List*' display state is %s" "Autosave `*Bookmark List*' state (aka \"menu list\") when you quit it" [bmkp-toggle-saving-bookmark-file] "Autosave Bookmark File" "Autosaving of bookmarks is %s" "Automatically save a bookmark after setting or changing it" [bmkp-save-new-location-flag] "Autosave after Relocating" "Autosaving relocated bookmarks is %s" "Automatically save a bookmark after automatically relocating it" [bmkp-prompt-for-tags-flag] "Prompt for Tags when Setting" "Prompting for tags when setting a bookmark is %s" "Prompt for tags when setting a bookmark interactively" bmkp-prompt-for-tags-flag] 9)
require(bookmark+-key)
eval-buffer(#<buffer *load*<2>> nil "/home/bigtyme/Dropbox/SyncedPrograms/emacs/loadPath/bookmarkplus/bookmark+.el" nil t) ; Reading at buffer position 5907
load-with-code-conversion("/home/bigtyme/Dropbox/SyncedPrograms/emacs/loadPath/bookmarkplus/bookmark+.el" "/home/bigtyme/Dropbox/SyncedPrograms/emacs/loadPath/bookmarkplus/bookmark+.el" nil t)
require(bookmark+)
eval-buffer(#<buffer *load*> nil "/home/bigtyme/.emacs" nil t) ; Reading at buffer position 1158
load-with-code-conversion("/home/bigtyme/.emacs" "/home/bigtyme/.emacs" t t)
load("~/.emacs" t t)
#[nil "\205\264
Sorted it out by just downloading the current git version. The version I downloaded from the wiki must have had a bug. Now I have no issues.
First, do what chrm recommends: get the latest source files.
Second, bmkp-menu-bar-make-toggle is a Lisp macro, defined in bookmark+-mac.el.
As always, before byte-compiling any of the source files, be sure you load the source file the defines the macros that those files use. In this case, load bookmark+-mac.el (not *.elc) before byte-compiling any of the Bookmark+ files.
I just tried it, and it works for me.
I downloaded bookmark+ from here. All eight files.
Just make sure all files are in a directory from your load-path.
The function (your Emacs can't find) "bmkp-menu-bar-make-toggle", is defined in "bookmark+-mac.el".
Related
I use Emacs to code. At the moment, to compile an OCaml project, I need to type make in a terminal. If there is an error, I have to go back to Emacs to find the erroneous file and location by following the error indication.
Now, I would like to launch make inside Emacs by a keyboard shortcut, which opens a buffer to show the compilation, then
1) if there is no error, then close the buffer automatically
2) if there is an error, another shortcut will lead me to the erroneous file and line within Emacs.
Does anyone know how to write .emacs to enable this mechanism?
PS: This is my current .emacs.
I have posted a question to compile one .tex file within Emacs by a shortcut (Ctrl + c + m + m), this works well. But in case of error, I don't ask it to lead me to the error position.
M-x compile RET
See the Emacs manual, node Compilation.
And see node Compilation Mode for how to visit error occurrences.
Some years back, I had the same question, here's the answer I got on the #emacs irc channel.
;; from enberg on #emacs
(setq compilation-finish-function
(lambda (buf str)
(if (null (string-match ".*exited abnormally.*" str))
;;no errors, make the compilation window go away in a few seconds
(progn
(run-at-time
"2 sec" nil 'delete-windows-on
(get-buffer-create "*compilation*"))
(message "No Compilation Errors!")))))
;; save the file when I press compile
(setq mode-compile-always-save-buffer-p t)
Org 8.2.10
Emacs 24.4.1
I have a bibtex entry in the scratch buffer, then M-w the entry.
It's in the kill-ring
I then swap to an org-mode buffer and try
M org-bibtex-yank
I receive an error: Wrong type argument: stringp, nil
I've toggled-debug-on-error and the backtrace is below. I have checked that the entry is on the kill-ring - I can yank it to a scratch buffer.
I've set debug-on-entry for org-bibtex-yank, and went a long way down the rabbit hole! I can see the entry in some steps of the debugger, but got lost!
I'd be grateful for any pointers on either the problem, or getting more information that might help.
thanks
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
looking-at(nil)
bibtex-parse-entry()
org-bibtex-read()
org-bibtex-yank()
call-interactively(org-bibtex-yank record nil)
command-execute(org-bibtex-yank record)
execute-extended-command(nil "org-bibtex-yank")
smex-read-and-run(("toggle-debug-on-error" "org-bibtex-yank" "debug-on-entry" "describe-function" "apropos" "set-variable" "package-list-packages" "load-theme" "describe-variable" "bibtex-yank" "eshell" "package-refresh-contents" "yank" "org-mode" "org-bibtex" "flyspell-mode" "server-force-delete" "org-bibtex-read-buffer" "R" "S" "S+" "cd" "dm" "5x5" "S+3" "S+6" "SAS" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "Sqpe" "calc" "diff" "dirs" "ffap" "gnus" ...))
smex()
call-interactively(smex nil nil)
command-execute(smex)
I know this issue "org-bibtex-yank fails with Wrong type argument: stringp, nil". Especially I can't paste an bibtex-entry from the web and paste it to an Org file via org-bibtex-yank.
My current work around:
Open in Emacs buffer for the bibtex mode. May be you use a dummy.bib
In bibtex-mode buffer call
M-x bibtex-set-dialect
Choose either bibtex or biblatex
Now I paste the bibtex-entry to the bib-file and check the behavior:
- Mark and copy via M-w a bibentry in the bibtex-mode buffer
- Change to your Org file
- Use there
M-x org-bibtex-yank.
Typically now it works.
The issue seems to be that bibtex-parse-entry requires that bibtex-set-dialect is called before calling it.
Unfortunately you can't do a (simple) file variable in a bibtex file.
M-x add-file-local-variable
for variable bibtex and value either bibtex or biblatex won't work.
As bibtex.el does not support this.
Try in Org file
# Local Variables:
# eval: (bibtex-set-dialect 'biblatex)
# End:
Try in bibtex file
M-x add-file-local-variable
and replace the line
bibtex: biblatex
by
eval: (bibtex-set-dialect 'biblatex)
Or read:
https://tex.stackexchange.com/questions/78455/does-emacs-support-editing-bibliography-files-for-biblatex
I have been searching for an answer/solution to this problem. I am not sure how it happened or what I did (if anything), but when I hit F3 to run a batch file for SAS in ESS[SAS] mode, it doesn't work. I have been using it all day and it suddenly just doesn't work anymore... If I call M-x ess-sas-global-unix-keys while in SAS-mode I can use the F3-F6 buttons, but having (setq ess-sas-global-unix-keys t) in my init.d file upon opening a .sas file doesn't bind F3-F6 to the necessary commands.
Also, when I now open a .sas file, I get the message "File mode specification error: (void-variable ess-ac-sources)" and the F3-F6 key-bindings no longer work in SAS-mode.
I checked to make sure I have everything up-to-date (everything appears to be: i.e. auto-complete, ess), I debugged using M-x toggle-debug-on-error, but I can't find what is wrong (not that I would necessarily know what I am looking for, I am still new to Emacs).
In my init.el file, the only reference I have to ESS is the ess-sas-global-unix-keys. I feel like the specification error is having an effect on the ESS[SAS] keybindings, but I don't know how to fix it. I am also at a loss as to why it just started happening, even though I had been using it all day long. What can I do?
EDIT:
As per the comments, I will be sending an email to the ESS-help mailing list as well as listing out the backtrace list from the debug-on-error.
Debugger entered--Lisp error: (void-variable ess-ac-sources)
ess-load-extras()
ess-mode(((ess-local-customize-alist quote SAS-customize-alist) (ess-language . "SAS") (ess-dialect . "SAS") (ess-mode-editing-alist . SAS-editing-alist) (ess-mode-syntax-table . SAS-syntax-table) (inferior-ess-program . inferior-SAS-program-name) (ess-help-sec-regex . "^[A-Z. ---]+:$") (ess-help-sec-keys-alist . " ") (ess-object-name-db-file . "ess-sas-namedb.el") (inferior-ess-objects-command . "objects(%d)") (inferior-ess-help-command . "help(\"%s\",pager=\"cat\",window=F)\n") (inferior-ess-exit-command . "endsas;\n") (ess-loop-timeout . 500000) (inferior-ess-primary-prompt . "^") (inferior-ess-secondary-prompt . "^") (comint-use-prompt-regexp . t) (inferior-ess-start-file) (inferior-ess-start-args . inferior-SAS-args-temp) (inferior-ess-font-lock-defaults . SAS-mode-font-lock-defaults)) nil)
SAS-mode()
set-auto-mode-0(SAS-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer cleaning-0yr.sas> "~/Documents/datasets/PROMISE/data/scripts/cleaning-0yr.sas" nil nil "~/Documents/datasets/PROMISE/data/scripts/cleaning-0yr.sas" (5673145 2049))
find-file-noselect("~/Documents/datasets/PROMISE/data/scripts/cleaning-0yr.sas" nil nil t)
find-file("~/Documents/datasets/PROMISE/data/scripts/cleaning-0yr.sas" t)
call-interactively(find-file nil nil)
Not sure what happened since I had tried this before, but today I again replaced (setq ess-sas-global-unix-keys t) with simply (ess-sas-global-unix-keys) (at the suggestion from the ESS-help mailing list) and the F3-F6 buttons now work in ESS[SAS] mode. I did get an update to emacs this morning, so that may have contributed to the fix. I still get the "File mode specification error..." though.
EDIT
As per #wvxvw comment, including (defvar ess-ac-sources nil) into the init.el (or .emacs) file prevented the "File mode..." error from occurring.
We use an internal scripting language (let's call it pkc), which allows for embedding C++ code. The C++ code segments are delimited by {{{ and }}} markers.
I create an emacs mode for this language, using Generic Mode and mmm-mode.
Here is what I got (stripped down non-essential parts for posting here):
(require 'generic-x)
(setq pkc-imenu-generic-expression
'(("macros" "^[ \t]*macro[ \n\t]+\\([a-zA-Z0-9_]+\\)" 1)
("functions" "function[ \n\t]+\\([a-zA-Z0-9_]+\\)" 1)
))
(require 'cc-mode) ;; for c++-mode
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(define-generic-mode
'pkc-mode ;; name of the mode to create
'("//" ("/*" . "*/")) ;; comments are same C++ comments
'( ... ) ;; some keywords
'("\\.pkc$") ;; files for which to activate this mode
;; other functions to call
'((lambda ()
(mmm-mode 1)
(setq mmm-submode-decoration-level 2)
(setq imenu-generic-expression pkc-imenu-generic-expression)
(which-function-mode 1)
(c-initialize-cc-mode t)
(c-init-language-vars-for 'c++-mode)
(c-common-init 'c++-mode)
(c-update-modeline)
(message "pkc-mode[mmm] is on")))
"A mode for pkc source files" ;; doc string for this mode
)
(mmm-add-classes
'((embedded-c++
:submode c++-mode
:face mmm-default-submode-face
:front "{{{"
:front-offset -1
:back "}}}"
:back-offset 1)))
(mmm-add-mode-ext-class 'pkc-mode nil 'embedded-c++)
When I load the source file with embedded C++ code segments, they are highlighted somewhat less than what would have been if C++ mode was the major mode (that's not my problem, however). When the cursor in C++ code, the modeline changes to pkc/l[C++/l] (as expected).
The problem is, whenever I press TAB to indent a line, I get the error Wrong type argument: stringp, nil. When I turned on debugger, this is the stack trace I see:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
c-syntactic-skip-backward(nil nil t)
c-looking-at-decl-block(nil t)
c-guess-basic-syntax()
c-indent-line()
#[nil \302>\203)\212\303 \210\304\305x\210\303 \210\306 )i\306 X\203\"\307 !\202'\212\307 !))\20 \207" [indent-line-function column (indent-relative indent-relative-maybe) beginning-of-line "\n " nil current-indentation indent-line-to] 2 1908700 nil]()
c-indent-command(nil)
c-indent-line-or-region(nil nil)
call-interactively(c-indent-line-or-region nil nil)
Looking at the definition of c-looking-at-decl-block and particularly the call to `c-syntactic-skip-backward, I find:
(c-syntactic-skip-backward c-block-prefix-charset limit t)
Examining the first argument c-block-prefix-charset reveals that its value is nil. Doing the same from a plain C++ buffer shows a non-nil value. So, I suspect that C++-mode requires some initialization that's not being properly done.
So, my questions are:
What am I missing in the C++-mode initialization section in my implementation?
Am I using the right approach (combining generic-x and mmm-mode)? Is there a better approach?
I also see another error (File mode specification error) when I load the file, but I suspect the problem is the same or something similar.
Thanks for your time.
(Rewritten after the discussion in the comments, for any later visitors).
The setup in the question is basically fine, but to work with current c++-mode you need to use an updated version of mmm-mode. It's available at the GitHub project page and also at Melpa.
The relevant patches (one, two, three) added new entries to the value of mmm-save-local-variables, which mmm-mode uses to decide which local variables to save or restore when leaving or entering a submode region.
From what I understand, a future update to cc-mode can add more such vars, so the list may need to be updated from time to time.
Extra tip: to have better indentation in the subregions, you may want to wrap the submode's indent-line-function with some code that will narrow the buffer before calling it (example here). Depending on the indentation function (and whether it calls widen), it may or may not help.
When I call find-file to open a new file, it generally happens that the file I'm looking for is in one of the directories I've already loaded from.
Ideally, I'd like to scroll through the history using the up/down arrows.
The problem with this is that if I've already loaded 10 files from a directory, I first have to pass through those ten files, all in the same directory, before I see a new directory where my file might be.
In the end, I often just type in the directory again or cut/paste it from an xterm.
in the find-file command, can I change the behavior of the up/down arrows to iterate over directories instead of files.
Alternatively, can I change the file order to match the order of buffers most recently visited instead of when I loaded the file?
My first answer suffered from the behavior that TAB completion no longer worked as expected in 'find-file. But the technique still seems useful (and if you like it, preferable).
However, this solution has the same history behavior, but maintains the TAB completion as expected inside 'find-file.
I'd be interested to know if there were a way to avoid advising find-file, but I couldn't find any introspection that gave me the knowledge that 'find-file was called.
(defadvice find-file (around find-file-set-trigger-variable protect activate)
"bind a variable so that history command can do special behavior for find-file"
(interactive (let (inside-find-file-command) (find-file-read-args "Find file: " nil)))
ad-do-it)
(defadvice next-history-element (around next-history-element-special-behavior-for-find-file protect activate)
"when doing history for find-file, use the buffer-list as history"
(if (boundp 'inside-find-file-command)
(let ((find-file-history (delq nil (mapcar 'buffer-file-name (buffer-list))))
(minibuffer-history-variable 'find-file-history))
ad-do-it)
ad-do-it))
I suggest IDO. You can search in the buffer list or in find-file. When searching in find-file and it has no matches in the current folder it searches through history.
not what you want, but
have you tried (electric-buffer-list) Ctrl-x Ctrl-b?
or (dired)?
This will use the buffer-list's order for the history, which is what you want.
(setq read-file-name-function 'my-read-file-name)
(defun my-read-file-name (prompt dir default-filename mustmatch initial predicate)
(let ((default-directory dir)
(files (directory-files dir))
(history (delq nil (mapcar 'buffer-file-name (buffer-list)))))
(completing-read prompt files predicate mustmatch initial 'history)))
Hmmm... This changes the behavior of find-file's TAB completion because the TAB completes over the history (already opened files), and not over the files available in the directory you're specifying.
Getting both to work at the same time is a bit trickier...
With Icicles you can cycle among candidate file names, and you can sort them in many ways. You can access them in order of last use etc.
http://www.emacswiki.org/emacs/Icicles_-_History_Enhancements
http://www.emacswiki.org/emacs/Icicles_-_Sorting_Candidates
http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input