How do I do closures in Emacs Lisp?
Found another solution with lexical-let (defun foo (n) (lexical-let ((n n)) #'(lambda() n))) (funcall (foo 10)) ;; => 10
Found another solution with lexical-let (defun foo (n) (lexical-let ((n n)) #'(lambda() n))) (funcall (foo 10)) ;; => 10
Another easy option is to run highlight-lines-matching-regexp on the expression .\{81\}. Every line with 81 characters or more will be highlighted with the color of your choice.
This should work: (add-to-list ‘auto-mode-alist ‘(“\\.rr” . R-mode))
If you actually want batch processing of stdin and sending the result to stdout, you can use the –script command line option to Emacs, which will enable you to write code that reads from stdin and writes to stdout and stderr. Here is an example program which is like cat, except that it reverses each … Read more
You can set up your emacs-server to use a tcp connection (not just a local socket), and then on the remote side, tell emacsclient to connect to that tcp connection: In your .emacs (setq server-use-tcp t) (setq server-host “name_of_local_machine”) (server-start) And then on the remote side: emacsclient -f ~/.emacs.d/server/server /`hostname`:/path/to/local/file The above call to emacsclient … Read more
Don’t disable the warning. It’s there for a good reason: ~/.emacs.d shouldn’t be in your load-path. This is because Emacs writes files to this directory, and therefore it’s possible (there are existing cases) for those files to conflict with the names of elisp libraries. If you have this directory in your load path, and you … Read more
Try: (require ‘misc) Then use M-x forward-to-word and see if it does what you want. You can then rebind M-f, etc. To make the _ not a word separator (i.e. make it a word constituent) for C & C++ mode, you would do this: (modify-syntax-entry ?_ “w” c-mode-syntax-table) (modify-syntax-entry ?_ “w” c++-mode-syntax-table) For more information … Read more
If you don’t want to be annoyed by window stealing and resizing, put the following lines in your .emacs for a definitive solution that works even with libraries like gud that tries to open a new frame when they can’t steal your windows : (see this answer for info on the following advice) (defadvice pop-to-buffer … Read more
There’s also ‘paredit. The cheat sheet shows you all the commands available. happen to like it better than the electric mode suggested in another answer. Though paredit does only apply to (), so it may not meed your needs. But, to be honest, there’s a bunch of packages surrounding parenthesis. The wiki has them all … Read more
If you’re setting $PATH inside your Emacs, you might well be on OS X. GUI applications are not started via your shell, so they see different environment variables. Here’s a trick which I use to ensure the $PATH inside Emacs is the same one I see if I fire up a terminal (but see “update” … Read more