elisp

Emacs Lisp Align Keybinding Definition in init file

I have the following line in my Emacs init file. (global-set-key (kbd "C-x a r") 'align-regexp) Is there any way to hard-code in a particular regex so that I don't have to specify it every time? ...

Simplest Emacs syntax highlighting tutorial?

I would like to create only a syntax highlighting minor mode for Emacs. I have the "Writing GNU Emacs Extensions" by O'Reilly, but it does not go into any depth of detail. Is there a simple tutorial for a real or fake programming language highlighting mode? Thank you ...

In Lisp (Clojure, Emacs Lisp), what is the difference between list and quote?

From reading introductory material on Lisp, I now consider the following to be identical: (list 1 2 3) '(1 2 3) However, judging from problems I face when using the quoted form in both Clojure and Emacs Lisp, they are not the same. Can you tell me what the difference is? ...

strpos in Emacs Lisp

Is there a native Emacs Lisp function that behaves like strpos() in PHP? It should return the position of first occurrence of the given string in current buffer. Function search-forward is nice, but it modifies the character position. ...

Open dired and select the file associated with the previous buffer?

Let's say I am editing blah.txt with Emacs and I decide to open dired to rename the file blah.txt. When I press C-x d RET (or C-x C-f RET), a dired buffer will show up to display the content of the directory containing blah.txt, but the cursor will not be on blah.txt. So I need to search my file first (C-s blah.txt) to place my cursor on...

What does the elisp error "Wrong type argument: sequencep, t" mean?

I'm trying to byte-compile cc-mode 5.31.3 using emacs 23.1.1 as follows: $ emacs -batch --no-site-file -q -f batch-byte-compile *.el But two of the files are failing to compile (in addition to numerous warnings): In c-init-language-vars-for: cc-mode.el:168:10:Warning: Function `mapcan' from cl package called at runtime cc-mode.el:16...

what is called ring in emacs?

Unlike windows style self explanatory copy/cut/paste commands, I could not understand ring concept in emacs. Since I don't program very often in emacs, I could have not realized the value of ring feature. Can you tell me what is called ring in emacs and how to use it? ...

What is the correct way to join multiple path components into a single complete path in emacs lisp?

Suppose I have variables dir and file containing strings representing a directory and a filename, respectively . What is the proper way in emacs lisp to join them into a full path to the file? For example, if dir is "/usr/bin" and file is "ls", then I want "/usr/bin/ls". But if instead dir is "/usr/bin/", I still want the same thing, wi...

What does #[...] mean in emacs-lisp?

Hello everyone! I am puzzled by the expression #[nil "\300\207" [nil] 1] as a value of skeleton-pair-filter-function. Is this an alternative way of writing function in elisp? Or lisp in general? Thanks. ...

wrap a function in emacs lisp

In 1987, I wrote the code I'm going to paste in a moment. The mechanism used here to capture the initial function binding of switch-to-buffer doesn't work any more, resulting in infinite recursion. I guess that there's a right way to do this sort of thing now, could someone please fill me in? (defvar *real-buffer-switcher* nil) (defun ...

How can I access the path to the current directory in an emacs directory variable file?

According to the Emacs documentation, Directory Variables apply to all files below a directory that contains an .dir-locals.el file. How can I, in that file, set a variable to the full path that contains the file? For example: ((nil . ((indent-tabs-mode . t) (my-project-path **THIS_DIRECTORY**)))) ...

How can I easily reload Emacs lisp code as I am editing it?

As an Emacs beginner, I am working on writing a minor mode. My current (naive) method of programming elisp consists of making a change, closing out Emacs, restarting Emacs, and observing the change. How can I streamline this process? Is there a command to refresh everything? ...

Emacs elscreen - How to disable "split screen"?

I've got elscreen on my emacs for tabbed windows but it's splitting my screen in 2 like so... |-------| | | |-------| | | |-------| How would I make it only display one screen? The only things in my .emacs file is.. 135;; --------------------------------------- ...

How viable is emacs LISP aside from editing emacs?

I'm in my second year of my CS major, and I've only had courses in C (first course and then a polymorphic data structures course), C++ (OOP focus), MIPS assembly, and a compiler course. I worked in WinForms and C# over the summer. I worked through the Little Schemer and I'm really interested in learning some sort of LISP. Emacs is my e...

Programatically send an email from an elisp function

I need to automatically send an email from within an elisp function. Hypothetically, I would like a single function which I can pass in the to, from, subject, body, and possibly other headers. Does such a function exist? If not how could it be implemented? ...

smart-operator.el not autoloading ... what gives?

Hi all, I'm trying to use smart-operator.el in emacs. I've put the following into my init.el file: (add-to-list 'load-path "~/.emacs.d/dotemacs_git/smart-operator/") (require 'smart-operator) (smart-operator-mode 1) That doesn't seem to turn on smart-operator-mode automatically ... I still have to do M-x smart-operator-mode to get...

In GNU Emacs, what is `[C-tab]`?

In GNU Emacs, what is [C-tab]? Consider: (version) "GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1" (defun key-binding-test () (interactive) (insert " key-binding-test called ")) For a single letter control character, a character constant must be used in the vector: (global-set-key [C-l] 'key-binding-test) ; ...

Writing a parser with Wisent

Hi! I've described a grammar in a .wy file, but how can I build the parser? Also, sorry if this question is too simple, but I'm having a bad time figuring out how to use CEDET. Are there any docs besides the gentle intro and the info files? Thanks! ...