I had this in my
(setq ido-create-new-buffer 'always) (ido-mode 1) (ido-everywhere 1)
The first line allowed me to open buffers with nonexistent files just by saying
C-x b name RET. The second turned Ido on, and the third was supposed to force Ido to intercept all file/buffer selection commands (which did not really work that way).
This is what I have now:
(of course, I had to
(require 'icicles) or install Icicles from Marmalade, which I did).
So the journey has begun. (The main inspiration were Drew Adam’s posts on the help-gnu-emacs mailing list, especially in an answer to my question about project management tools in Emacs.)
Just a few first thoughts:
1. I have to hit
TAB for (prefix) completion. In Ido, the completions were updated after each keypress. (Not that it bothers me much, I just have to change my habits a bit.)
C-c ` is now bound to
icicle-search-generic, which interferes with
next-error in AUCTeX. Not a big deal, there are other bindings for that. (Also,
C-c ' is now busy – with
icicle-occur – which interferes with Org-mode. The same applies.)
3. I have yet to learn how to combine a few search terms…
I am now going to read through (some of) the EmacsWiki pages on Icicles to build new habits. Stay tuned!
C-x n C-h gives a short overview of what narrowing commands are there available in Emacs. Unfortunately,
narrow-to-defun does not (as I hoped) narrow to the current environment in LaTeX. This is Emacs, however, so why not fix this problem? Here’s a
LaTeX-narrow-to-environment function I wrote some time ago.
(defun LaTeX-narrow-to-environment (&optional count) "Narrow buffer to current LaTeX environment (or COUNT environments around point)" (interactive "p") (LaTeX-mark-environment count) (narrow-to-region (save-excursion (goto-char (region-beginning)) (beginning-of-line) (point)) (region-end)) (deactivate-mark))
I decided that
C-x n e is a natural binding:
(eval-after-load 'latex '(define-key LaTeX-mode-map (kbd "C-x n e") 'LaTeX-narrow-to-environment))
eval-after-load form is needed in my
LaTeX-mode-map is not actually defined until loading
As can be seen, it is basically a wrapper around
LaTeX-mark-environment – it even accepts the prefix argument of how many environments up the syntax tree it should go.
I guess everyone did it at some point: you press something accidentally, and something happens, and you don’t know what you have done, but it might be something stupid, or destructive, or smart. You press
C-/ and you’ll never know what that was.
Well, don’t be so quick with undo, then. There are more options.
C-h l, or
M-x view-lossage. It shows you the lat 300 keystrokes you pressed. (If you do this more often, you might also use
M-x open-dribble-file, which is basically an Emacs keylogger.)
But it also happens that you are not sure whether you accidentally deleted something, and
C-h l might not help with that. Then, you can
M-x revert-buffer; but before that, you may want to do
M-x diff-buffer-with-file. It does exactly what it says on the tin, and might come handy some day.
(Więcej means More in Polish; click it to see older entries.)