clemera
  • Member for 6 years, 5 months
  • Last seen more than a month ago
How to turn off `emacs-lisp-checkdoc` of flycheck when edit source block in org-mode file?
Accepted answer
16 votes

tl;dr Disable the checker emacs-lisp-checkdoc with the org-src-mode-hook. (defun disable-fylcheck-in-org-src-block () (setq-local flycheck-disabled-checkers '(emacs-lisp-checkdoc))) (add-hook '...

View answer
How to start emacs in "nothing" mode (`fundamental-mode`)
Accepted answer
15 votes

When you use M-x find-file-literally Emacs will not invoke a mode that is based on the file name. Instead, it uses fundamental-mode as the major mode. From the command line you can use something like ...

View answer
How to remove bindings to the ESC prefix key
Accepted answer
11 votes

You can do (define-key key-translation-map (kbd "ESC") (kbd "C-g")). I did the same a long time ago and had no problems. Edit to improve the answer according to the comments: If you want to keep the ...

View answer
How to use Flyspell to efficiently correct previous word?
7 votes

With helm-flyspell you can choose from the list of corrections efficiently. I use the following code to jump to the errors and correct them with it, it saves the position of the point to the mark-ring ...

View answer
Can emacs commands be called from a shell script?
Accepted answer
6 votes

You can use the following emacs lisp code saved in htmlize-script.el: (add-to-list 'load-path "/path/to/htmlize/") (require 'htmlize) (defun htmlize-files-in-dir (dir) (htmlize-many-files (...

View answer
elisp regular expression build problem
Accepted answer
5 votes

Emacs regexps do not use \S or \s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page. It's ...

View answer
in yasnippet, how to insert variable date with fixed time of day?
Accepted answer
5 votes

You can use the format-time-string function to format the time in different ways, for your example this should work: * TODO meditate SCHEDULED: `(format-time-string "<%Y-%m-%d %a 8:30am>" (...

View answer
How can I start learning Emacs Lisp?
4 votes

As a refresher on Lisp I highly recommend the first three chapters of Peter Norvigs Paradigms of Artificial Intelligence Programming. Those give you a great and fast pace (re)introduction to Lisp ...

View answer
How to re arrange things in mode line?
4 votes

You can use the following code and adjust mode-line-align-left, mode-line-align-middle and mode-line-align-right to your liking. (setq-default mode-line-format (list mode-...

View answer
Disable all keymaps for a specified buffer?
Accepted answer
4 votes

You can use a minor-mode and use a default mapping. Have a look at the define-key documentation for details about default definitions in keymaps. (define-minor-mode disable-keys-mode "Disables all ...

View answer
Assign evil-mode keys dependent on major-mode
Accepted answer
4 votes

You can use evil-define-key. For example to bind "a" in normal-state to different commands in org-mode and emacs-lisp-mode, you would do: (evil-define-key 'normal org-mode-map "a" 'bar) (evil-...

View answer
List all buffers with specific mode?
4 votes

To do it programatically you can use (get-buffers-with-minor-mode 'aggressive-indent-mode) using the following code: (defun get-buffers-with-minor-mode (minor-mode) "Get a list of buffers in which ...

View answer
Editing HTML structurally
Accepted answer
4 votes

Tagedit is what you want. From the README: tagedit-forward-slurp-tag moves the next sibling into this tag. tagedit-forward-barf-tag moves the last child out of this tag. tagedit-raise-tag replaces ...

View answer
Minibuffer for each window
Accepted answer
3 votes

For Emacs 26 and later you can use emacs-maple-minibuffer or ivy-posframe if your are using ivy. Those packages let you configure to popup a minibuffer frame at any position, including the current ...

View answer
improving isearch
Accepted answer
3 votes

For quick direction change and wrap around you can use the following: (defun isearch-repeat-forward+ () (interactive) (unless isearch-forward (goto-char isearch-other-end)) (isearch-repeat-...

View answer
Is there an emacs command to go to end of code line (before line comment and whitespaces start)
Accepted answer
3 votes

The package mwim offers this functionality. By setting (global-set-key (kbd "C-e") 'mwim-end) you get behavior similar to what you described. The package also offers the corresponding mwim-...

View answer
How to select non-contiguous regions in Emacs?
3 votes

Another way is to use the objed package (I'm the author). You can mark any text object with m the point is moved to the next object of current type automatically. Unmark any object by navigating to it ...

View answer
How configure the confirmation minibuffer to use Enter, instead y?
Accepted answer
3 votes

As @phils commented simply redefining the key in query-replace-map will effect other things as well. The following copies the key-map to avoid that: (defun y-or-n-p-with-return (orig-func &rest ...

View answer
How to make browse-url-of-buffer load the same html file in the same tab in Firefox?
Accepted answer
3 votes

As far as I know the only solution is to adjust the settings in Firefox: Enter about:config in your address bar, confirm and search for browser.link.open_newwindow.override.external and set it to 1. ...

View answer
How to preserve emacs key bindings when changing keyboard layout?
Accepted answer
3 votes

As far as I understand your question the key-translation-map seems like a good soultion for your problem. For example if you would like to have C-q acting like C-a as in your example, you would define ...

View answer
Can helm-apropos display the key bindings for commands the way helm-M-x does?
Accepted answer
3 votes

Welcome to helm, you will like it ;) One way to do it is to just overwrite the original function which builds the source for the apropos command candidates with this: (defun helm-def-source--emacs-...

View answer
Change highlight color when window isn't in focus?
2 votes

You can use window-selection-change-functions. By adding a function locally the function is called each time when the window showing that buffer has been selected/deselected (see the docstring for ...

View answer
Commands with Keybindings only
Accepted answer
2 votes

You can use the following command which is independent of the used completion framework because it uses completing-read: (defun execute-binding+ (arg) "Completing read a command and execute it. ...

View answer
search for strings and subheadings in org heading
Accepted answer
2 votes

The following commands search within current heading or within current top level heading when called with prefix argument: (require 'rx) (require 'cl-lib) (defun org-goto-top-level+ () (let ((rx (...

View answer
Rebind just `C-c` to some command
2 votes

That is not so easy, because C-c is a general prefix key in Emacs. Here is a hacky way to achieve that, don't know if there are better options: (add-hook 'eshell-mode-hook 'my-hacky-C-c-remap) (...

View answer
How to tell Ivy to use completing-read-default for specific command? (org-tags-view, in particular)
Accepted answer
2 votes

Are you sure you executed the code? I just tried: (push '(org-tags-view . completing-read-default) ivy-completing-read-handlers-alist) and it worked as expected. Responding to the comment: ...

View answer
Why does this code fail to nullify all keybindings in a keymap?
2 votes

At some point when activating little-library-mode the keymap stored in the variable little-library-mode-map gets added to minor-mode-map-alist: (push (cons 'little-library-mode little-library-mode-...

View answer
Are there hooks for leaving modes?
2 votes

Not for major-modes, for minor-modes the hook runs on exit as well (See here). The major mode is responsible to make changes which affect other packages buffer locally. You probably should send a PR ...

View answer
Keybinding conditional on cursor location?
2 votes

Another method is to use menu-item: (defun my-at-beg-of-line () (interactive) (message "Only at beg of line")) (global-set-key [home] '(menu-item "" nil :filter (lambda ...

View answer
Show org-mode hyperlink as plain text
2 votes

Org mode achieves the link effect using the following code: (if org-descriptive-links (add-to-invisibility-spec '(org-link))) This adds org-link to the variable buffer-invisibility-spec which means ...

View answer