Konstantin Morenko
  • Member for 5 years, 5 months
  • Last seen more than a month ago
1 answers
4 votes
4k views
How to quickly create a new directory without using dired-mode?
Accepted answer
8 votes

You could use M-x make-directory DIRNAME RET. The default path is the path to the current buffer folder. You could bind it to key (like C-x C-f) with (global-set-key (kbd "C-c d") 'make-directory). ...

View answer
1 answers
3 votes
2k views
Org mode: Adding a properties drawer to a capture template?
Accepted answer
6 votes

You could use this function and the hook in init.el (defun add-property-with-date-captured () "Add DATE_CAPTURED property to the current item." (interactive) (org-set-property "DATE_CAPTURED" (...

View answer
2 answers
7 votes
2k views
how to disable automatic dos mode?
Accepted answer
6 votes

From the https://www.emacswiki.org/emacs/EndOfLineTips You can reopen the file with the correct line ending with a command like M-x revert-buffer-with-coding-system utf-8-dos. If your file is not ...

View answer
1 answers
3 votes
417 views
Mark repeated tasks done for good!
Accepted answer
5 votes

According to orgmode manual (8.3.2 Repeated tasks): To mark a task with a repeater as DONE, use C-- 1 C-c C-t (i.e., org-todo with a numeric prefix argument of -1.) You could use C-u - 1 instead ...

View answer
1 answers
0 votes
107 views
Is there a key-binding to move the cursor to the last character in the buffer
Accepted answer
5 votes

C-end (and M-> and another in default) runs command end-of-buffer (into simple.el), which moves cursor to the end of the buffer. With numeric argument, for example, C-u 4 C-end, moves point to 4/...

View answer
1 answers
2 votes
481 views
Disable C-Tab in magit mode
Accepted answer
4 votes

According to Remove key binding in magit-status-mode use in init.el (with-eval-after-load 'magit-mode (define-key magit-mode-map (kbd "<C-Tab>") nil)) The (with-eval-after-load FILE &opt ...

View answer
1 answers
1 votes
203 views
How to create a file from a template if it does not exist or open existing copy?
Accepted answer
4 votes

You could use this version of the function: (defun journal-entry () (interactive) (let* ((daily-name (format-time-string "%Y-%m-%d)")) (journal-path "~/Dropbox (Personal)/journal/") (...

View answer
1 answers
0 votes
107 views
Return nth line from (current) buffer
Accepted answer
4 votes

This could be done with the next function (with or without narrowing): (defun get-nth-line (number) "Get line with NUMBER" (save-restriction (widen) (save-excursion (goto-line ...

View answer
1 answers
2 votes
271 views
Ignoring subtrees with a certain tag
Accepted answer
3 votes

You could comment the subtree with C-c ; (org-toggle-comment). If the subtree marked COMMENT, it will not be tangled. I use it into my init files (with org-babel-load-file) to temporary exclude some ...

View answer
2 answers
10 votes
4k views
How can I see which version of a package I'm using?
3 votes

You could use M-x list-packages to view list of available and installed packages with versions. And you could mark packages for update with U, then use x to eXecute the updating. And M-x package-...

View answer
2 answers
2 votes
887 views
How do I open a non-readable file from inside emacs when I opened emacs as a regular user?
3 votes

You could use https://stackoverflow.com/questions/95631/open-a-file-with-su-sudo-inside-emacs, for example C-x C-f /sudo::/path/to/file

View answer
2 answers
3 votes
305 views
Fold preface/ preamble of an org file
Accepted answer
2 votes

I use in my files special heading, for example Settings and hide all the in-buffer settings there. It works very well even in the beginning and in the end of the file. If you use Global Cycling (S-...

View answer
2 answers
1 votes
2k views
where does org-mode get the \author field for latex output
Accepted answer
2 votes

Each export back-end has AUTHOR keyword, associated with global variable user-full-name. If it's empty, the \author will not be exported. You could redefine it into the file (buffer) with #+AUTHOR: ...

View answer
1 answers
2 votes
521 views
Can't change the line-highlight color
Accepted answer
2 votes

When you put your code before load-theme, loading theme could change value of this variable. Put your code after load-theme in your init.el.

View answer
1 answers
0 votes
145 views
Binding modified key in evil mode
Accepted answer
2 votes

In (define-key KEYMAP KEY DEF) the KEY is internal representation of keys, where prefix keys must be \C- or \M-. A way to convert keys into internal representation is to use (kbd KEYS) function, ...

View answer
2 answers
5 votes
907 views
How to make emacs automatically kill buffer after invoking delete-file command?
2 votes

You could use this function instead of delete-file (defun delete-file-kill-buffer (filename) "Delete the file buffer is visiting and kill the buffer." (interactive "fFile name: ") (progn (...

View answer
1 answers
0 votes
48 views
How can make emacs immediately compile a file I load?
Accepted answer
2 votes

You could add hook into init.el (add-hook 'find-file-hook (lambda () (when (string= major-mode "c-mode") (recompile)))) for c-mode to recompile it automatically ...

View answer
2 answers
2 votes
300 views
Move the cursor backwards to the end of the 1st word on it's between 2 words
2 votes

You could move cursor to the beginning of the first word with M-b (backward-word) and then move forward with M-f (forward-word), which place cursor after the end of the first word. For example (* ...

View answer
2 answers
0 votes
289 views
M-x query-replace but replace all in a file
2 votes

You could use this function for replacing strings (defun replace-in-buffer () "Replace text in whole buffer. Change OLD string to NEW string" (interactive) (save-excursion (replace-string (...

View answer
1 answers
1 votes
123 views
Hook to insert content into a particular file when visited
Accepted answer
2 votes

You could use this version of your function (defun insert-foo-bar () (when (string= (find-file-nondirectory buffer-file-name) "foo") (insert-file-contents "~/bar"))) (add-hook 'find-file-hook '...

View answer
2 answers
1 votes
971 views
How to reuse last input in command with a prompt?
Accepted answer
2 votes

You could use read-string and give they default value def-say-word and save in later. (setq def-say-word "default value") (defun say-word (word) (interactive (list (read-string (format "Say ...

View answer
1 answers
1 votes
66 views
Python src block sets tabs
Accepted answer
1 votes

From documentation: ‘org-src-preserve-indentation’ Default is ‘nil’. Source code is indented. This indentation applies during export or tangling, and depending on the context, may ...

View answer
1 answers
0 votes
669 views
A read list in Org
1 votes

You could use org-after-todo-state-change-hook, which Hook which is run after the state of a TODO item was changed. The new state (a string with a TODO keyword, or nil) is available in the Lisp ...

View answer
1 answers
5 votes
113 views
How can I access the :file src header argument inside the src block
1 votes

You could wrap the output with next code and create file and link after block #+name: attr_wrap #+begin_src sh :session :var file=/tmp/py87133eo.png echo "$data" > /tmp/$file ln -s /tmp/$file /...

View answer
3 answers
1 votes
1k views
How to copy text from a buffer to an ansi-term
1 votes

From the doc for term-mode: The terminal emulator uses Term mode, which has two input modes. In line mode, Term basically acts like Shell mode. In char mode, each character is sent directly to the ...

View answer
1 answers
1 votes
365 views
Run a command with C-c C-c for a specific major mode
Accepted answer
1 votes

Running shell command could be done with (shell-command COMMAND). Then we need to make string for executing command. We'll concatenate it from sections with (concat ...). We have 5 sections of the ...

View answer
2 answers
1 votes
101 views
Convert lines into list in web-mode
1 votes

Lets start with conversion one line with this function (defun wrap-line (before after) "Convert line at the point adding BEFORE and AFTER." (save-excursion (progn (goto-char (line-...

View answer
1 answers
1 votes
393 views
Create a presentation from Org mode
Accepted answer
1 votes

load-path is the list of directories, not files. If you want to add this file, use in ~/.emacs.d/init.el (load-file "~/org-html5presentation.el") (require 'ox-html5presentation) Better way is to ...

View answer
2 answers
8 votes
2k views
How to print a PDF, displayed with pdf-tools, from Emacs?
1 votes

Print with: asks you for a command to print with. In most Linux distros you could use lp or lpr command to send files to printer. More about lp: http://linux.die.net/man/1/lp

View answer
2 answers
0 votes
30 views
Exclude different subtrees from export when using different back-ends
0 votes

The one way I've found is to create settings file for each case: html.org #+EXCLUDE_TAGS: odt #+INCLUDE: main.org odt.org #+EXCLUDE_TAGS: html #+INCLUDE: main.org And then export each file with ...

View answer