Allows to:
It is quite useful when one needs to quickly switch between different places in one or several buffers, typically when programming.
It is very light, as emacs provides something called "registers" which mainly does the work. Actually this package is only a wrapper mixing a list of buffers and registers.
The package does not assign any keystroke by itself, the user must assign them in its config files. The following code makes use of the keypad on the right of a standard pc french keyboard. Modify it as you want, a good idea is to use f(5-12) keys instead.
(setq circul-uninteresting-buffer-regexp "\\`\\*\\|\\` \\|.+\\.log\\'\\|bbdb\\|TAGS") (setq circul-uninteresting-buffer-exception-regexp "\\`\\*coq\\|\\`\\*cvs\\*") ; Navigation in interesting buffers (global-set-key [(control kp-enter)] 'circul-bury-buffer) (global-set-key [(control kp-add)] 'circul-unbury-buffer) (global-set-key [(control meta button4)] 'circul-bury-buffer) (global-set-key [(control meta button5)] 'circul-unbury-buffer) ; Assigning keys to buffers or registers ; In this example we assign keys of the numpad: ; * C-kp-x assigns kpx to a buffer ; * C-S-kp-x assigns une position in a buffer (i.e. a register) to k-px ; * kp-x jumps to the position of buffer assigned to kp-x ; Note that ?0 .. ?9 mais be replaced by other characters, provided ; they are all different. (circul-assign ?0 [(control kp-insert)] [(control shift kp-0)] [(kp-insert)]) (circul-assign ?1 [(control kp-end)] [(control shift kp-1)] [(kp-end)]) (circul-assign ?2 [(control kp-down)] [(control shift kp-2)] [(kp-down)]) (circul-assign ?3 [(control kp-next)] [(control shift kp-3)] [(kp-next)]) (circul-assign ?4 [(control kp-left)] [(control shift kp-4)] [(kp-left)]) (circul-assign ?5 [(control kp-begin)] [(control shift kp-5)] [(kp-begin)]) (circul-assign ?6 [(control kp-right)] [(control shift kp-6)] [(kp-right)]) (circul-assign ?7 [(control kp-home)] [(control shift kp-7)] [(kp-home)]) (circul-assign ?8 [(control kp-up)] [(control shift kp-8)] [(kp-up)]) (circul-assign ?9 [(control kp-prior)] [(control shift kp-9)] [(kp-prior)])
This is inspired from other interactive programs ( Pcoq ). It allows to defines "holes" in your buffer. A hole is a piece of text (with nothing particular except it is highlighted) that may be replaced by another piece of text later. This feature is useful to build complicated expressions by copy pasting several peaces of text from different parts of a buffer (even from different buffers). Holes are just highlighted pieces of your buffer, nothing is written in your file and you can delete holes exactly like normal characters (there are other ways to delete a hole, see below).
There is always one or zero active hole, highlighted with a different color.
To define a hole, two methods:To activate a hole, click on it with the button 1 of your mouse.
To forget a hole without deleting its text, click on it with the button 2(middle) of your mouse.
To destroy a hole and delete its text, click on it with the button 3 of your mouse.
To replace the active hole first make sure it is active, then two methods:
to jump to the active hole, just hit meta-return. You must be in the buffer containing the active hole. the point will move to the active hole, and the active hole will be destroyed so you can type something to put at its place. The following hole is automatically made active, so you can hit meta-return again.
It is also useful in conjonction with abbreviations, for example in c-mode I use "f" as an abbreviation for for(#;#;#) {#}, where each # is a hole, then hitting meta-return goes from one hole to the following and I can fill-in each hole very quickly. This last trick needs some very simple manipulation on your abbrev file. See some examples in my : abbrev file .
There are four files in this archive, three of them are used to deal with this f... Emacs/Xemacs incompatibility.
To use these two files, download them and put them (untar
holes.tgz with the command tar xvfz holes.tgz
, you
get a directory with four files) somewhere Xemacs can find
them. Then put this in you initialization file:
(require 'holes-load)
(require 'circul)
The files span.el, span-extent.el and span.el are from the ProofGeneral mode. Everything is under GPL. It should work on both FSF Emacs(21) and Xemacs. Ideas for improvement and bug reports are welcome.
magit
is quite easy
to use for nomianl use. I was unhappy with magit
's
way of splitting/deleting windows, so I put this in my
initialization file (notice that for quitting I only redefine the
"q" keybinding, the menu "quit" still kills the window):
(defvar pc:magit-from-buffer "Buffer from where magit-status were last called." nil) (defun pc:magit-status-buffer-switch (buf) "My replacement for `magit-status-buffer-switch-function'. `magit-status' does not split windows (switch to magit buffer instead). Also store the current buffer to switch back to it when quitting. TODO: store the whole frame config instead?" (setq pc:magit-from-buffer (current-buffer)) (switch-to-buffer buf)) (setq magit-status-buffer-switch-function 'pc:magit-status-buffer-switch) (defun pc:magit-quit-window (&optional kill-buffer) "My replacement for \"q\" keybinding in magit. Bury the current (magit) buffer and switch to original buffer. With a prefix argument, kill the magit buffer instead." (interactive "P") (if kill-buffer (kill-buffer) (bury-buffer)) (switch-to-buffer pc:magit-from-buffer)) (add-hook 'magit-mode-hook '(lambda () (define-key magit-mode-map (kbd "q") 'pc:magit-quit-window)))
(add-hook 'LaTeX-mode-hook '(lambda () (turn-on-reftex); Turn on RefTeX Minor Mode for all LaTeX files (define-key LaTeX-mode-map [(control f12)] 'TeX-next-error) (define-key LaTeX-mode-map [(control f11)] '(lambda () (interactive) (TeX-command-menu "LaTeX")))Now hit (control f11), it compiles, if there are some errors, type (control f12) and it goes straight to the error and shows the message. See also the ref menu to navigate through the table of content of your document.
(defvar latex-process-timer nil
"the timer used to watch latex and dvips processes.")
(defun send-sig (process-string sig)
"sends sig signal to every process having name process-string"
(interactive)
(call-process "killall" nil nil nil sig process-string))
(defun wait-latex-xdvi ()
"wait for the latex process to stop, and send the USR1 signal to all
running xdvi.bin processes"
(if (TeX-active-process)
()
(let ((x (current-message)))
(send-sig "xdvi.bin" "-USR1")
(if (featurep 'xemacs) (delete-itimer latex-process-timer)
(cancel-timer latex-process-timer))
(message x))
)
)
(defun latex-xdvi ()
(interactive)
(TeX-command-menu "LaTeX")
(setq latex-process-timer (run-with-timer 1 1 'wait-latex-xdvi)) ;; latex-process-timer is a global variable
)
Then replace the control f11 shortcut above by this one:
(add-hook 'LaTeX-mode-hook '(lambda ()
...
(define-key LaTeX-mode-map [(control f11)] 'latex-xdvi))
)