Home About me Blog Po polsku

Content AND Presentation

(Note to English-speaking readers: the links entitled Komentarze na tej stronie lead to comment pages.)

2014-11-22 From Ido to Icicle – first steps

I had this in my init.el:

(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:

(icy-mode 1)

(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.)

2. 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!

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryIcicles

Komentarze na tej stronie

2014-11-15 LaTeX-narrow-to-environment

Hitting 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))

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")

(The eval-after-load form is needed in my init.el, because LaTeX-mode-map is not actually defined until loading latex.el.)

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.

Happy TeXing!

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryTeX

Komentarze na tej stronie

2014-11-08 I messed up - Emacs to the rescue

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.

One is 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.

CategoryEnglish, CategoryBlog, CategoryEmacs

Komentarze na tej stronie


(Więcej means More in Polish; click it to see older entries.)

CategoryEnglish, CategoryBlog