Adobe
  • Member for 7 years, 3 months
  • Last seen more than a week ago
  • Moscow, Russia
Named string substitution?
Accepted answer
18 votes

Re-writing this answer gives another solution: (format-spec "%a %a %a %b %b %b" (format-spec-make ?a "a" ?b "b")) Edit: Another format-spec solution: As Malabarba gives ...

View answer
Quickly insert source blocks in org mode
15 votes

Here's a function which inserts the code block: (defun org-insert-source-block (name language switches header) "Asks name, language, switches, header. Inserts org-mode source code snippet" ...

View answer
Collapse sections in markdown
Accepted answer
15 votes

With markdown-mode by Jason Blevins you can toggle folding of the heading with Tab (same as in org-mode).

View answer
How to find out what my AUCTeX version is?
Accepted answer
14 votes

It is contained in the AUCTeX-version variable: C-h v AUCTeX-version RET

View answer
Two Python modes
Accepted answer
12 votes

Well yes there are two python modes: the one which ships with emacs is python.el and the other one is python-mode.el which is indeed this one: https://launchpad.net/python-mode Your tutorial has been ...

View answer
Browser-style 'tabs' for emacs?
10 votes

Split buffers in groups It is possible with tabbar. You can add rules to group buffers in groups. Here's a basic snippet: (defun tabbar-buffer-groups () "Returns the list of group names the ...

View answer
How to change the title from emacs@host to file name
9 votes

Make emacs' window title show path of the current file: (setq-default frame-title-format '(:eval (format "%s@%s: %s %s" (or (file-remote-...

View answer
What are the major features planned for GNU Emacs 25?
9 votes

When Emacs 25 will be released you'll find its NEWS file here: http://www.gnu.org/software/emacs/news

View answer
Can I use org-mode to structure my .emacs or other .el configuration file?
8 votes

One more vote for outline-mode. For example for organaizing .emacs I use the following syntax: ;;; HEADING: the important parts are ;;; and :\n (add-hook 'emacs-lisp-mode-hook (lambda () ...

View answer
Idiomatic way of extending keymap for inserting unicode symbols?
Accepted answer
7 votes

There's no need to define a command to bind a unicode char: (define-key 'iso-transl-ctl-x-8-map "a" [?α]) binds α to C-x 8 a. While (define-key 'iso-transl-ctl-x-8-map (kbd "M-s") [?ς]) binds ς to ...

View answer
multiple files in LaTeX?
7 votes

If you break latex doc into several files you can still work with the whole project just fine in emacs, all you need is to set the master file in each file you include. For this put the following at ...

View answer
What do I do when Emacs is frozen?
5 votes

It also sometimes helps to abort-recursive-edit with C-].

View answer
why does cdr return a list of one element?
5 votes

When given a list cdr returns a list from second element to the end: (car '(1 2 3)) ; ⇒ 1 (cdr '(1 2 3)) ; ⇒ (2 3) Exceptions to this include: lists of fewer than two elements: (cdr nil) ; ⇒ nil (...

View answer
where are emacs lisp files?
5 votes

If you are looking for source of a function <name>, you can find a link to the source in the description of the function: C-h f <name> RET In your case it will be: C-h f linum-mode RET ...

View answer
Syntax highlighting for comments in text mode
Accepted answer
4 votes

Works for me: (setq comment-start "#") (font-lock-add-keywords nil '(("#.+" . font-lock-comment-face))) Edit Here's a more general solution: (defun set-comment-char (char) "Sets comment char for ...

View answer
How to install Auctex
Accepted answer
4 votes

I just installed it from source: get the source code: http://www.gnu.org/software/auctex/download.html build: ./configure --prefix=$HOME/.emacs.d/site-lisp/auctex --with-lispdir=$HOME/.emacs.d/site-...

View answer
Word delimiters in standard syntax table
3 votes

As far as I understand, in emacs -- word boundary is when next to a "w" syntax class stands char of some other class. This is in contrast to things like sentence-end which is determined by matching a ...

View answer
Use emacs for batch-processing files
3 votes

Here are two apporaches one uses only emacs, and the other also uses shell. In both cases it is usefull to separate the problem in two: write a defun which process a single file get the list of ...

View answer
Can I avoid outdated byte-compiled elisp files?
3 votes

I met this on the Internet long time ago: ;; If you're saving an elisp file, likely the .elc is no longer valid: (add-hook 'emacs-lisp-mode-hook 'esk-remove-elc-on-save) (defun esk-remove-elc-on-save ...

View answer
Add hook for specific files
Accepted answer
2 votes

I usually do it by adding a commented heading to a file: # -*- truncate-lines:1 -*- But this can also be done as file-name specific hook: (defun really-long-lines.org_file_hook () (when (string= (...

View answer
Tabify: How does Emacs decides where to place tabs?
Accepted answer
2 votes

From the description of tabify: A group of spaces is partially replaced by tabs when this can be done without changing the column they end at. So it seems like it's behaviour depends on tab-...

View answer
How does AUCTeX determine the documentclass?
2 votes

You can check TeX-style-hook-list: (if (member '("beamer") TeX-style-hook-list) (message "beamer is used") (message "beamer is not used") ) Edit My solution is based on expecting aux file ...

View answer
How to reopen just killed buffer, like C-S-t in Firefox Browser?
1 votes

ErgoEmacs has a function close-current-buffer which in particular keeps a list of recently closed buffers: (defvar recently-closed-buffers (cons nil nil) "A list of recently closed buffers. The max ...

View answer
How to maximize my Emacs frame on start-up?
1 votes

I'm using the following: (when (eq system-type 'gnu/linux) (defun x11-maximize-frame () "Maximize the current frame (to full screen)" (interactive) (x-send-client-message nil 0 nil "...

View answer
How to define custom compile commands in auctex?
1 votes

I assume you call your compile scripts like this: ~/bin/script1.bash master.tex and that you only has to call it once. In this case here's a defun which does it: (defun tex-custom-compile (arg) (...

View answer
How do I replace a block of text with another block of text in elisp?
0 votes

This plain replace-regexp seems to cut it: (defun org-replace-h1 () (interactive) (let ((mytext " :PROPERTIES: :ID: h1 :END: This is some UPDATED text. As you can see, it can be ...

View answer
One key shortcut to jump two-ways between matching opening/closing tags in nxml mode?
0 votes

Try the following: (defun nxml-jump-to-closing-tag () (interactive) (forward-char 2) (if (search-backward "<" nil t) (nxml-forward-element) (message "No more elements") ) ) (...

View answer
elisp pattern for handling region || buffer || file
0 votes

I'd use something like this: write a general basic processing defun, with start-end interface determine what you has been given set start and end apply basic processing defun Here's an ...

View answer
Convert a word into an acronym
0 votes

Here it is: (require 's) (defun mu--convert-word-to-acronym (string) "Convert the given STRING in an acronym. An acronym must be uppercase and have each letter followed by a dot." (insert (s-...

View answer
How can I automatically use curved quotes in text, but straight quotes in HTML tags?
0 votes

You can try the following: (defun insert-html-quote () (interactive) (save-restriction (save-excursion (let (backward-nearest-< backward-nearest->) (save-excursion ...

View answer