Normally the easiest way to debug is using printf. What can I do to debug emacs-lisp? How can I print something to emacs editor from elisp? Or is there any way to debug elisp code?
For example, how can I check if the following code is run in .emacs file?
(load "auctex.el" nil t t)
...
I have the following piece of code in my .emacs:
(dolist (mode '(scheme emacs-lisp lisp clojure))
(add-hook
(intern (concat (symbol-name mode) "-mode-hook"))
(lambda ()
(progn
(run-programming-hook)
(message "%s" (concat (symbol-name mode) "-mode")))
Obviously the mode variable is void when lambda gets to ...
I have been searching everywhere in the emacs lisp documentation for how to regular expressions search into a string. All I find is how to do this in buffers.
Is there something I'm missing? Should I just spit my string into a temporary buffer and search for it there? Is this just the coding style of elisp, something I'll get used to?...
I found this snippet to add to my .emacs that will, on save, strip out tabs and replace them with spaces (to help my files play nicely with everyone else on the team who uses spaces).
Unfortunately, my lisp and emacs lisp chops are not very strong. It seems to be this snippet will work only for the java major mode - how can I get this t...
Hi
I would like to translate the following function from vim script to emacs elisp (I use it to set the email recipients when writing emails).
My question is mainly how to get and set line contents in emacs, because with quick googling I could not find this out (probably I just did not know the right terms to google for, "getline" and...
Let's say I need to check if hello.el file is read or not.
(defun hello ()
"Test"
(interactive)
(message "Hello, world"))
(format "hello")
(provide 'smcho)
I used the (format "hello") to show something, but it doesn't seem to work.
How can I know if an elisp module is read.
...
As is asked and answered here. I could use 'lein swank' to run clojure on Aquamacs.
I need to automate running 'lein swank', before running slime/clojure.
Q : Is there a way to this automatically? I mean how can I run the command 'lein swank' automatically when slime/clojure (M-x slime-connect) is called.
Q : If I have to come up wit...
I'm attempting to run P4V commands directly from xemacs.
After pulling in the p4.el to emacs I've written the following:
(defun p4v-command (cmd)
(get-buffer-create p4-output-buffer-name);; We do these two lines
(kill-buffer p4-output-buffer-name) ;; to ensure no duplicates
(call-process "p4v" nil (get-buffer-create p4-output...
I created my own color theme using this website. I've added a new .el file to my ./site-lisp/color-theme/themes directory with the following code:
(defun your-config-name-here ()
(interactive)
(color-theme-install
'(your-config-name-here
((background-color . "#ffffff")
(background-mode . light)
(border-color . "...
I have some elisp code in smcho.el.
The problem is whenver I change the functions in this file, I have to reload emacs.
Is there any way to reload this elisp file only?
(Added based on the answer) Is there any way to redo the previous loading easily? I guess M-x load-file and give the file name again over and over again can be improved...
Let's say I have the following line in .emacs file.
(setq-default default-directory "~/Desktop/mag")
How can I check the value for `default-directory' in elisp?
Added
I asked this question as I need to check the value of default-directory based on this question.
The elisp code should change the default directory when I click C-x C...
I want to write a function that will call a list of functions in emacs (specifically, kill-buffer-query-functions), but if any of them require user interaction, I want to have them simply return nil instead, so that the whole thing will run non-interactively. I am thinking of using defadvice to modify every function that would normally p...
In Emacs Lisp (elisp), if I want to get several values from the user, is there a better
way than just asking for each value in turn in the minibuffer?
Ideally, there would be a library that would let me define an input form with several
fields, present that form to the user (as a text-based dialog in text mode, and as a
GUI-based dialog...
Is it possible to present Markdown rendered in an Emacs buffer using Emacs' own buffer text formatting capabilities? Emacs in graphical environments has rich text presentation capabilities (font styles, colors, links and even images) so it should be quite possible. Are there any existing implementations?
Note that the idea is to have th...
I have written function (actually a macro, but whatever) that works similarly to progn. How can I tell emacs that this function should be indented in the same way as progn?
...
How do I close all but the current buffer in Emacs? Similar to "Close other tabs" feature in modern web browsers?
...
In Emacs, I'm using a color scheme with a dark background and light text. When working with .rst files, I have a mode for that which uses rst.el. However, rst.el highlights headings with a light background color, which makes reading light text on it impossible!
I think that this is the section of code in rst.el that is responsible for t...
Is there a way to trigger the execution of an emacs lisp function other than M-x myfun? I would like to have the function re-called every time the buffer is changed.
Background: I have a table of numbers with some mistakes. The table has column totals and other features which can be used to identify the mistakes. My elisp function highl...
I have a question about elisp vectors.
Are integers and characters actually stored (efficiently) inside the vector or via a reference (pointer)?
Vectors can hold arbitrary objects; For example:
(setq v (make-vector 10 nil))
(aset v 0 "Hello World")
In this case it's obvious that the vector cell 0 keeps a reference (pointer) to the st...
search for filename . "myfile.txt"
(regexp-quote "filename \. \"\\(.+\\)\"")
"filename \\. \"\\\\(\\.\\+\\\\)\""
search for filename . "myfile.txt (without last quote)
(regexp-quote "filename \. \"\\(.+\\)")
Debugger entered--Lisp error: (invalid-read-syntax ") or . in a vector")
read(#<buffer processing-files.el>)
preceding-sexp...