icarus
  • Member for 5 years, 5 months
  • Last seen this week
Change permission of file
Accepted answer
15 votes

The easy to remember (if you are used to unix) way is M-x chmod which is an alias of set-file-modes

View answer
Replace two strings with each other
Accepted answer
12 votes

For the interactive case query-replace-regexp (C-M-%) can do this, using the relatively unknown \, for the replacement. C-M-% \(string1\)\|\(string2\) \,(if (equal \& "string1") "string2" "...

View answer
Magit: how remove push branch?
7 votes

Bring up the magit status window with M-x magit-status or whatever shortcut key binding you use. type b to bring up the branch menu. type p to cycle through the push options enough times to get to ...

View answer
After enabling ivy-mode, `dired-create-directory' does not allow me to choose an entry not in the completion list
Accepted answer
6 votes

Yes. There are 2 cases. The name you want to create doesn't match anything in the completion list, or when it does. When it doesn't, you can just type in the name and press enter. If it does match, ...

View answer
simple function in dired to create a dir with current date?
Accepted answer
6 votes

You seem to be over thinking this. (defun z/dired-insert-date-folder () "Create new directory with current date" (interactive) (dired-create-directory (format-time-string "%d%m%Y"))) Your ...

View answer
How do I match a closing bracket in Emacs lisp
Accepted answer
6 votes

Put the ] as the first character after the [ which starts the character class, e.g. [])}] This is the manual page

View answer
Speed up Emacs start-up time
5 votes

Side note, it is generally considered a good idea to have your startup code in ~/.emacs.d/init.el rather than ~/.emacs, one less hiden file in your home directory, a suffix so that other editors can ...

View answer
Which functions cannot be redefined after byte compilation?
Accepted answer
5 votes

If you look at (symbol-plist 'not) you will see that it has a byte-opcode property with value byte-not. So the elisp compiler will use this rather than a general function call. I have not looked for ...

View answer
Key bound to string does not handle some chars in string correctly
5 votes

global-set-key is just a thin wrapper around define-key, ignoring some error checking it is (defun global-set-key (key def) (define-key (current-global-map) key def)) The documentation for define-...

View answer
Result of arithmetic evaluation in buffer, not echo area
4 votes

If you want to do an arithmetic operation and insert the value into the buffer, but don't care where you do the operation, then you can also do C-u M-: and type the operation info the minibuffer. ...

View answer
pasting from websites results in 1 long line..anyway to keep the paragraph format?
Accepted answer
4 votes

Just run fill-paragraph bound by default to M-q Depending on where you are copying from, remember that the paragraph is one logical object, how it shows depends on the width of the browser on your ...

View answer
How do I stay on org's "bleeding edge"?
Accepted answer
4 votes

I believe all you need to do is delete the elpa package (use M-x list-packages, find org-mode, type d to mark it for deletion and x to execute the changes), and add the new directory to your load path,...

View answer
How do I create a new directory from within ranger?
Accepted answer
4 votes

I am assuming this is talking about the https://github.com/ralesi/ranger.el package available from Melpa. There are several things you can do Use "!" to run a command. This is made slightly tricky as ...

View answer
how to rename a file in neotree without ivy select confusing?
Accepted answer
3 votes

ivy has more than one way of exiting the selection process, not just pressing enter. In particular ivy-immediate-done which is bound to C-M-j has the following help text exit with the current action,...

View answer
Magit: amend the last commit with sign off
Accepted answer
3 votes

Changing the last commit message What you are wanting to do is change (rewrite) the last commit message to add the signed-off line. Go to the git status window (a common key binding is C-x g) type ...

View answer
Using default results with ivy and `read-file-name`
Accepted answer
3 votes

read-file-name has lots of optional parameters. You are supplying default as the value for default-filename. The documentation says that this is the value used if the user exits with the same non-...

View answer
connect to remote emacs session via ssh
Accepted answer
3 votes

Since this is running on X, it might be possible to use a program like xdotool , xdo, or wmctrl All these programs allow you to list windows, select one, and simulate typing on them. Another ...

View answer
Key mapping: Push `M-q` once for fill-paragraph and twice for unfill-paragraph
3 votes

Something like (defun xuhdev/fill-paragraph () (interactive) (if (eq last-command this-command) (unfill-paragraph) (fill-paragraph))) and then binding xuhdev/fill-paragraph to M-q ...

View answer
Magit - How to update a branch without using checkout?
Accepted answer
3 votes

In addition to @phils valid observation, there is f o for fetch other, you can then give it origin and then foo. This will update the origin/foo branch, rather than the foo branch. Or you can use f r ...

View answer
query-replace-regexp on specific lines
3 votes

If you want to add a prefix of hello to all lines which start with a letter, you can use C-M-% ^\([a-zA-Z]\) hello \1 The idea is to use \(...\) to capture stuff and \1 to represent the first ...

View answer
Make org-mode not to insert day name in timestamps
Accepted answer
3 votes

Yes. You can customize the variable org-time-stamp-custom-formats and remove the %a from the default. Note you also need to set the org-display-custom-times variable to something other than nil.

View answer
How to sort bash functions alphabetically?
2 votes

If you only have things like you show, and no blank lines, then sort-paragraphs will do what you want. Go to the start of the file, and invoke it. Assuming that your real life example is harder than ...

View answer
No such file or directory error on executing script
Accepted answer
2 votes

Assuming that ctrl-c ctrl-x is bound to execute-interpret, then the system should prompt you with the command to run, suggesting as a default /path/to the/script/test.sh as a default. Edit this ...

View answer
Create term buffer duplicate with coloring preserved
Accepted answer
2 votes

(defun sandric/duplicate-current-term-buffer () (interactive) (let ((duplicate-buffer (get-buffer-create "NEWBUF")) (term-point (point)) (term-window-start (window-start)) (...

View answer
Go to window by buffername
2 votes

For a slightly different approach, you can install the https://github.com/abo-abo/ace-window package (available from melpa) and bind ace-window to some key sequence. When you invoke it, it gives each ...

View answer
Got problem 'Wrong number of arguments: setq, 3' when trying to open file
2 votes

As I said in https://emacs.stackexchange.com/questions/28155/unable-to-update-packages-on-emacs-25-1#comment43164_28155 one of the changes in emacs is that now setq requires an even number of ...

View answer
^M character suddenly appearing upon opening file
2 votes

Are you sure every line ends with a ^M? If just a single one doesn't then you will get the symptoms you describe. You can search for such lines with isearch-forward-regexp, e.g. escape ctrl-s [ ^ ...

View answer
Configure gud to invoke python3 debugger instead of python debugger
Accepted answer
1 votes

At least in emacs 27, this is controlled by the customization gud_pdb_command_name. The easy way to set it is to invoke pdb once, to get past any autoload issues, then M-x customize_option ...

View answer
Prepend to block of text, but ignore blank lines
1 votes

An answer to a different question would be to add _oldflags=$- ; set -a as the first line of the file and [[ "$_oldflags" =~ a ]] || set +a ; unset _oldflags which tells bash to export all the ...

View answer
Magit status wired output (control sequences)
Accepted answer
1 votes

The two different machines had different ~/.gitconfig files, in particular one had an option selecting color always rather than when the output was going to the terminal. The ^[[32m and similar are ...

View answer