Has anyone written any libraries for elisp to do CGI programming? I threw together a quick first script. However, I'm only a long-time emacs user and I've never really programmed it. When I saw that I could write scripts (--script) in emacs instead of bash, I thought that I would give it a shot.
#!/usr/bin/emacs --script
(princ "Co...
How can I make SQL queries from within emacs scripts to MySql then print the result set?
#!/usr/bin/emacs --script
(setq sql "select id, name
from foobar
order by name
")
(princ sql)
...
I'm trying to write a little Emacs Lisp script that reads a csv file from standard input, turns all the rows into a table then prints it to standard out (Unix). I wrote a basic version that takes a csv string and outputs the table to a buffer. However, I would like to turn this into a Unix utility script.
#!/usr/bin/emacs --script
(...
I was reading subr.el and saw this code:
(defalias 'backward-delete-char 'delete-backward-char)
(defalias 'search-forward-regexp (symbol-function 're-search-forward))
Interestingly, the first line doesn't use symbol-function while the second line does. The only difference I know of these two ways of using defalias is that the help for...
I recently upgraded to Emacs 23.1.50, and Slime stopped connecting - it would start the inferior-lisp, but never connect. After some investigation, I found that it would work if started from emacs -q and then everything up until and including the call to slime would work. Is there any way to force the remainder of my customizations to ...
In GNU Emacs, I want to run a program, figlet, on the currently selected text. I then want to comment the region which is produced.
I have figured out how to do it using the standard Emacs commands:
set mark with C-<space> at the start of the word
move cursor to the end of the word
C-u M-x shell-command-on-region RET figlet RET
M-x co...
In GNU Emacs, is there a good way to change the comment-region command in C mode from
/* This is a comment which extends */
/* over more than one line in C. */
to
/* This is a comment which extends
over more than one line in C. */
? I have tried
(setq comment-multi-line t)
but this does not help. There is a section on multi-...
In TextMate, one can use ctrl-shift-w to wrap text in an Open/Close tag and ctrl-shift-cmd-w to wrap each line in a region in Open/Close tags. How can I implement this same functionality in Emacs using emacs lisp?
emacs
becomes
<p>emacs</p>
And ...
emacs
textmate
vi
becomes
<li>emacs</li>
<li>textmate</li>
<li>vi</li>
...
I'm trying to get my Emacs shell to mimic that of my standard terminal sessions. Basically I would like it to respect the same PATH as well as the command prompt.
So far I have a few issues:
PATH isn't found, below is the fix I'm using for that.
I'm getting ascii color codes all over the place with another fix I tried.
I have the f...
I have the following emacs lisp snippet that will launch my browser from within emacs and open the specified pages. However when I run it as a script from a shell nothing happens. What more do I need to do? I tried dropping (interactive).
#!/usr/bin/emacs --script
(defun surf-news ()
(interactive)
(progn
(browse-url "http:...
Several times I see ^L in (mostly Emacs Lisp) source codes that looks like are separators of larger logical groups. Is it their real purpose? And if so, how can I use them? Is there a built-in Emacs functionality that utilize it?
...
How can I define an emacs command X that does something and then calls another emacs command Y and also copying the interactive interface of the command Y too?
I want to define an altenative version of query-replace with temporarilly toggled value of case-fold-search:
(defun alt-query-replace (a b c d e)
(interactive)
(let ((case-f...
I have not seen a really good example on the web. How can I add authentication to a request like this:
(defun login-show-posts ()
(interactive)
(let ((url-request-method "GET")
(url-request-extra-headers '(("Content-Type" . "application/xml"))))
(url-retrieve "http://localhost:3000/essay/1.xml"
(lambda (status)
...
What are some features of Emacs Lisp that you use to solve real problems?
One feature per answer
Give an example and short description of the feature, not just a link to documentation
Label the feature using bold title as the first line
See also:
Hidden features of Python
Hidden features of Ruby
Hidden features of Perl
Hidden featu...
I use the following smart-tab defun in my .emacs for either completion on a word or just to do a standard tab:
(global-set-key [(tab)] 'smart-tab)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, ex...
I'm trying to figure out Elisp, and I've hit a roadblock.
I want a function that will Indent the entire file. Right now, I'm selecting the whole file (C-x h) and then doing M-x indent-region (which does have a shortcut key).
I'd like to combine that in to a single keypress, but can't figure out how to do C-x h in a function.
Thanks
...
I was reading the Simple Database section of Peter Siebel's book Practical Common Lisp with the idea of maintaining a small database of around 50,000 records. I thought doing this in Emacs might be an interesting, and useful, exercise. Emacs Lisp is somewhat compatible with CL except for a few notable differences. The format function ...
Some online websites like to encode all their text through HTML entities, so instead of seeing a text
like
So I'm looking
You get something like:
So I'm looking 
I was wondering if there's a built in way to translate the encoded text to regular text using any
Emac...
It seems one is not supposed to quote KEYMAP when using define-key.
(define-key org-remember-mode-map "\C-c\C-r" 'org-remember-kill)
I'm confused because I think that all arguments of a function that is not quoted are evaluated, and according to the help, define-key is a function, not a macro. I don't see why the value of KEYMAP can b...
How can I write an Emacs Lisp function to find all hrefs in an HTML file and extract all of the links?
Input:
<html>
<a href="http://www.stackoverflow.com" _target="_blank">StackOverFlowh1>Emacs Lisp</h1>
<a href="http://news.ycombinator.com" _target="_blank">Hacker News/html>
Output:
http://www.stackoverflow.com|StackOverFlow
h...