Emacs New File Confirmation during Find-File Completion - emacs

Some Emacs package I use has turned off the find-file confirmation for choosing a new non-existing file that matches parts of existing file-names shown during completion. I want this confirmation back to the default. What customization option regulates this behaviour?
Example:
M-x find-file
Enter letter a
Pressing TAB now gives two candidates: a1 and a2
Just pressing Return should now query me to confirm through an extra Return. Indicated by a [Confirm] at the end of the minibuffer.

check the value of the variable confirm-nonexistent-file-or-buffer

Related

How to enable Arrow-Up (and Arrow-Down) key to show previous (or next) entered line in Emacs?

How to enable Arrow-Up (and Arrow-Down) key to show previous (or next) entered line in Emacs?
In Emacs, particular in Scheme mode, I want to use the ArrowUp and ArrowDown keys to navigate in the history or entered commmands, like I use to do in Bash.
However, pressing these keys in the Scheme interpreter (running inside Emacs) doesn't do anything except to go up or down one line in the buffer.
I guess the way to enable this history navigation applies to all modes?
I want to go the expression above i.e. '(1 2 3).
How do I enable it?
You need to get into the command buffer to get history of commands. Press M-x and then try Up /Down. When you are in a regular buffer, these are indeed navigation keys.
Also. have a look at Helm.
Edit (to sync the answer with the updated question, pulling the updated answer from the comments)
If the intention is to use history in the Lisp interpreter buffer, then C-up and C-down are the usual key bindings for that.

Emacs company mode inserts completion on space key pressed

Typing text in Emacs with company-mode turned on. When I stop at the end of a word company-mode shows available completions. Because the word is already written, it does not need to be auto-completed and I want to type another word, I press space key. company-mode inserts first suggestion instead of canceling auto-completion. Is this normal? How can I make company-mode to cancel auto-completion when I insert space character?
Example:
This file is
Cursor right after "is" and company-mode shows some auto-completion suggestions. After I press space key I get:
This file isearch-adjusted
("isearch-adjusted" was the first suggestion in the tooltip of company)
See the description of company-auto-complete, and set it to nil to disable this behavior.
It's nil by default, though, so it shouldn't have caught you unawares. Are you using someone else's Emacs config?

Tab in Emacs-helm (anything) does not autocomplete with current best match

While trying to autocomplete a file (e.g. to open a file with C-x C-f) Emacs-helm shows a list of possible candidates.
If I then press Tab (which I would hope it would help me choose the first/closest match), I get the following in the minibuffer:
It looks like the minibuffer gets confused with escape characters, and it does not choose the file that I actually want to open (the top choice).
Helm requires this conceptual jump from the default Emacs completion, which is not so obvious:
You don't need to press a key to complete. The completion buffer refreshes
with new results after every input.
This is called "incremental" completion.
The normal tab functionality is not needed in "incremental"
completion. So tab was rebound to helm-select-action, which allows you to
choose an alternative action with the selection. But there is only one action
in read-file-name.
The error you're seeing could be clearer though, I've filed this issue on github.
Additionally, note Helm treats each space separated term as a filtering
regular expression. So, pressing space foo will filter
the current list down to those that contain foo in the name.

How can I get emacs to open a new buffer quickly?

I used to be able to open a new buffer in Emacs quickly using the command C-x b <non existent buffer name>
Somehow I've broken this in my version of Emacs (23.1). When ever I try to do this now I get the message [No match] in the command buffer.
Does anyone know what I might have done to break this functionality, or is it possible that I imagined being able to do this?
Set confirm-nonexistent-file-or-buffer to nil:
confirm-nonexistent-file-or-buffer is a variable defined in `files.el'.
Its value is after-completion
Documentation:
Whether confirmation is requested before visiting a new file or buffer.
If nil, confirmation is not requested.
If the value is `after-completion', confirmation is only
requested if the user called `minibuffer-complete' right before
`minibuffer-complete-and-exit'.
Any other non-nil value means to request confirmation.
This affects commands like `switch-to-buffer' and `find-file'.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 23.1 of Emacs.
If you have enabled ido-mode, you can still switch to the behavior you're familiar with. I do this frequently when I know I'll be creating a new named buffer.
C-x b C-b
You press C-j instead of hitting enter twice, which will bypass the confirmation and immediately open the new buffer. This works with or without ido-mode. This will have the same effect has pressing enter with confirm-nonexistent-file-or-buffer set to nil.
You probably enabled ido-mode. You need to press ENTER to confirm the creation of the buffer.

Highlight buffer modifications

It often occurs that a file buffer is modified (duh!). Before exiting, emacs asks whether to save the changes. Now it would be interesting to know what actually changed. Is there a way to find out?
As of Emacs 22.1 (at least), 'save-buffers-kill-emacs (the default binding for C-x C-c) prompts you for each unsaved buffer that has a file. Type a d when prompted to save and see the diff.
From the help documentation:
Save some modified file-visiting buffers. Asks user about each one.
You can answer `y' to save, `n' not to save, `C-r' to look at the
buffer in question with `view-buffer' before deciding or `d' to
view the differences using `diff-buffer-with-file'.
If you look at the prompt, it should say something like:
Save file /path/to/file.txt? (y, n, !, ., q, C-r, d, or C-h)
Typing C-h gives you a little more verbose description (but d is what you are asking for):
Type SPC or `y' to save the current buffer;
DEL or `n' to skip the current buffer;
RET or `q' to give up on the save (skip all remaining buffers);
C-g to quit (cancel the whole command);
! to save all remaining buffers;
C-r to view this buffer;
d to view changes in this buffer;
or . (period) to save the current buffer and exit.
I use diff-buffer-with-file, and select the file that the buffer came from (which is the default anyway for the command... just hit enter).
You can also use highlight-changes-mode, though this won't track changes until you turn it on, so not so useful if you want to see what changed when you're closing a file that has not been in this mode :-)
You can have highlight-changes-mode enabled. It will display all changes in red. However it won't show you whitespace changes and will mark removals only with an red _. See also http://www.emacswiki.org/emacs/TrackChanges.
I found this post about tracking changes by djcb most helpful regarding tracking changes in Emacs. The trick is to add the following to your .emacs:
;; higlight changes in documents
(global-highlight-changes-mode t)
(setq highlight-changes-visibility-initial-state nil); initially hide
and then toggle highlight-changes-visible-mode when you want to see what has changed.
In this case I type undo to see the last change (usually some stray character which got typed in the wrong window, since I save early and often).
It would be nice if there were some other indication of the current changes, e.g. in the border like quick diff in Eclipse text editors.
I use goto-chg for things like that. It's not perfect, but it always is enough to jog my memory about what change I made and promptly forgot about.