elisp

emacs: visual-line-mode and fill-paragraph...

Hi, I am now using Emacs 23 with visual-line-mode turned of for text editing but keep hitting M-q out of habit (thus adding hard-wrapping line endings...). I wonder if there is a way to add a conditional to disable fill-paragraph (or remove the binding to M-q) for modes in which visual-line-mode is turned on, but to re-enable it for thos...

emacs defadvice on python-mode function

Hi! In python-mode, there is a function called py-execute-region which sends a highlighted region of code to the Python buffer for evaluation. After evaluation, the cursor is in the Python buffer, but I would prefer that it remain in the script buffer so I can continue producing more code. I wrote a simple advising function: (defadvice ...

Find-file with a hint?

Is there a way to give the 'find-file' function a hint? I'm working with files in the same directory on a remote server, and I'm getting tired of typing in the machine name, and directory structure all the time. It would sure be great if I could write a function that would bring up the find-file prompt with the machine name and directo...

Why do I start iswitchb-mode this way?

According to the emacs info page, here's how you enable iswitchb-mode: To enable Iswitchb mode, type M-x iswitchb-mode, or customize the variable iswitchb-mode to t So I put the following in my .emacs: (setq iswitchb-mode t) However, this doesn't seem to work. After searching the emacs wiki, I found that I need to use this: ...

Emacs noob haskell-mode question

EDIT I'm using GNU Emacs 23.0.95.1 and Haskell-mode 2.4, both from ports I used to use vim all the time, but have fallen in love with emacs and it's extensibility. I installed haskell-mode from ports on my FreeBSD 7.2 system, and everything seems to work fine so far except for the function haskell-hoogle. When I call the function it cre...

Updating font-lock keywords in emacs without major mode reload

I am doing small modification to SLIME, so that I can get all currently loaded symbols from Lisp, analyze them and make font-lock fontify them. I managed to do all these steps, but I have a small problem - when keyword list changes in font-lock the buffer is not updated unless you restart the major lisp-mode. I don't want to restart lis...

A beautifier for lisp?

Are there any beautifiers for (e)lisp? Online preferred ...

Vim style Omnicomplete for emacs?

I've found several code completion elisp packages for emacs that do code completion, but most bind to a key such as M-/ to toggle completion. Is there something similar to Vim's omnicomplete where you can set it to automatically pop up a list of autocompletion options where you can either navigate through them, or just keep typing. See...

emacs output buffer coding system?

Hi, I have in one of my directories an elisp file which I use to get a list of files: ((lambda () (let ((coding-system-for-write 'utf-8-emacs) (get-these-files '("FILE1" "FILE2"))) (cmd "scp user@remotehost:pathtofiles/ .&")) (mapcar (lambda (x) (shell-command (format cmd x))) get-these-files)))) [I use a lambd...

emacs: non-contiguous buffer region

I want Emacs' syntax motion functions to ignore certain regions of the buffer; i.e. to correctly parse non-contiguous regions. This can be done effectively if you can define the region to ignore as a comment and set parse-sexp-ignore-comments variable to true. Here's the problem. The primary mode has comments starting with '!' and end...

emacs - show help and message buffer in current window or in separate frame?

Hi, I have been working with emacs in a semi-full-screen configuration where my frame is 160 chars wide and as tall as the screen. In this layout I have my windows split in a certain way that I like. I wonder if there is a way to make help files and messages (e.g., the output when I run an asynchronous shell) pop up either in the same wi...

which shell-command in emacs lisp?

Hi, if I am trying to run a shell-command in an emacs lisp function in which I call rsync (or scp) multiple times, which shell-command variant should I use? I am currently using shell-command, which locks up emacs until the process is done, and the output that should be visible with the --verbose to rysnc is not printed; I can use shell-...

Horizontal split for pop-to-buffer in Emacs 23?

I have a few scripts that use the function pop-to-buffer a lot. It used to split the window horizontally, but now in Emacs 23 it splits the window vertically. I've dug through some of the elisp code but it's not jumping out at me - how can I change this behavior of Emacs 23 to split horizontally again? ...

strtotime for Emacs Lisp

Is there any functionality in Emacs Lisp that behaves similar to PHP's strtotime function? (Actually AFAIK it implements relative items of the GNU date input formats.) In PHP I can write echo strtotime("+2 months"); //1258891352 echo strtotime("-3 months +2 weeks"); //1246952239 which return the corresponding UNIX timestamps. ...

Traversing a directory tree

i am trying to traverse a given directory and create a list of files ending in .jpg. (setq files (list )) (defun jpg-list(directory) (dolist (node (directory-files directory t ) ) (if (file-directory-p node) (if (not (string= (substring node (- (string-width node) 1)) ".")) (jpg-list n...

Can an elisp piece of code "yield" so emacs doesn't block?

Is there any way to write something like this without taking over emacs? (defun dumb-wait (seconds) (let ((done (+ (second (current-time)) seconds))) (while (< (second (current-time)) done) (message "waiting")))) (dump-wait 5) will block emacs from 5 seconds. Is there anyway to write this so it doesn't block?...

elisp how to check if Shift key is pressed

I need to check if Shift key is pressed. More exactly I would like to set dired switches depending on whether Shift is pressed. (defadvice find-file-noselect (around find-file-noselect-set-switches activate) (let ((switches dired-listing-switches)) ;; check if shift is pressed and set or not an "R" switch (setq dired-listing-s...

How to have emacs auto-refresh all buffers when files have changed on disk

I have a non-emacs global search and replace function that causes my disk files to become more up-to-date than my emacs buffers (en masse). Is there any way to tell emacs to refresh all the buffers from disk in one fell swoop, instead of having to do each one individually by reloading the file? Thanks! D ...

How to use Emacs's url.el lib without having it ask the user on a 401 (Unauthorized) response?

I want to use url.el (and url-http.el specifically) to make some REST calls programmatically. The user has already specified the credentials via other means (but this is only mildly relevant -- I want to get the same behaviour for un-authenticated calls as well) but on certain queries I can still get a 401 (Unauthorized) response. I wan...

Figure out what buffers have been opened by a function in elisp?

I'm trying to write a plugin that calls a function (icalendar-import-file) which has the nasty side effect of opening between 1 and 3 buffers every time it is called, and sometimes I want to call it a whole bunch of times. I can't even find a function that will list buffers without popping up a new buffer, which is a little frustrating....