Adobe
  • Member for 7 years, 3 months
  • Last seen more than a week ago
  • Moscow, Russia
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
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
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
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
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
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
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
What do I do when Emacs is frozen?
5 votes

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

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 to include a text verbatim in Emacs Lisp?
-3 votes

Generally it is not possible, as elisp interprets all strings, and there doesn't seem to a way to prevent it doing so. However in this particular example it is possible -- as elisp interprets \d as ...

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
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
How would you explain Emacs to a non-technical person?
0 votes

"Emacs is a text editor which allows for easy text transformation from one format to another format. It has 10,000 text editing functions built-in."

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
Have table.el insert space after vertical separator for reStructuredText
0 votes

Perhaps the easiest way is to convert table to org-mode's table, and then convert it back. Here's the code: (require 'org) (setq save-y-or-n-p nil) (defadvice table-re-indent (around always-yes) (...

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
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
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
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 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
Is there a way to modify or redefine a type of org-link locally?
0 votes

I think you need to tweak org-open-at-point of org.el. It contains the following lines: ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line (string-to-number (match-...

View answer
Why do I have to add each package to load-path? (or Problem with require 'package in my init file)
0 votes

The following adds all dirs under ~/.emacs.d/site-lisp to load path, so you can just require the package and you are done: (let* ((my-lisp-dir "~/.emacs.d/site-lisp/") (default-directory my-...

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 make eww default browser in Emacs?
-1 votes

I set firefox as my default browser with (setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "firefox") I can't test it with eww because I'm on Emacs 24.3.1 -- but ...

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