Where is the "history" file in emacs? - emacs

Whenever I close emacs I get "End of file during parsing" while saving the history. , but I do not know where that history file is for me to fix. Someone has an idea, I know that M-p is back in history, M-n for next, and how do I delete the history? I did not find anything in the documentation about.
I found here about:
https://www.emacswiki.org/emacs/MinibufferHistory
but it does not tell me where to find the history file, where it is saved, or how to delete the history.

I searched for "while saving the history" with grep -R "while saving the history" /home/me/portacle/*, and found:
./all/emacsd/elpa/slime-20180701.1344/contrib/slime-repl.el: "%S while saving the history. Continue? "))
I discovered that it was slime-repl that it was causing, the file it saved in ~/.slime-history.eld.
I deleted the file(it was empty) and restarted the slime, so it re-created the file for me, and stopped causing the error.

Related

Emacs won't save settings anymore even when it did before

Got an odd problem. Lately, my EMACS
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
won't save settings. I noticed it before when I had to continuously reset the word-wrap. Now I tried to save an Org-agenda file (using C-left bracket) it said "file added to front of agenda file list" But if you turn off EMACS then do a c-a to pull up the current agenda, it still has the old files.
I've checked the permissions on the .emacs file; All is fine. So I'm not sure what's wrong? This is the first time ever it's happened.

how to handle duplicate file(.txt and .txt~) after save file with emacs

Sorry, I have a problem when I try to learn emacs in terminal, when I try to edit 1 file (file.txt) and I try to save this file with C-x C-s. I get 2 files with the same name (file.txt and file. txt~). how to handle duplicate file after save file with emacs on mac osx?
The ~-suffixed file is a backup copy of the file, with the state it had before you started editing.
You can disable such automatic backing up.
You can also control various aspects of such backing up, including where backup files are to be stored -- see the Emacs manual, node Backup and its subnodes.
You can also remove all of the backup files in a directory at once, by visiting the directory using Dired: C-x d. After visiting it, use ~ to mark all backup files for deletion, then x to delete them. See the Emacs manual, node Flagging Many Files.

emacs can't open files outside current directory

So here is an interesting error...there is a particular folder on my desktop (hdrive, connected to a university-wide backup system, was set up automatically by IT) where emacs has difficulty opening files. In some directories within hdrive emacs can't open files above the current directory. For example,
cd ~/hdrive/directory/
emacs ../another_directory/file
gives the error message
emacs: `get_current_dir_name' failed: No such file or directory
I get the same error if instead I try
emacs ~/hdrive/another_directory/file
The files themselves are not missing and not corrupted, as using cat in place of emacs in these commands works fine. And I don't get this problem with all directories in hdrive - sometimes even a directory with this problem will have a subdirectory without it - but the directories with this problem are consistent.
There is no .dir-locals.el anywhere in hdrive, so that can't be messing things up.
Any ideas?
For me, this problem occurred because I was standing in a folder that I had deleted and recreated in another terminal (git issue).
Navigating away from the folder and back again made emacs and/or the terminal understand which folder I was actually in, and I could start emacs again with no problems.
I doubt this will solve the specific issue the questioner had, but anyone else ending up on this page through a google search on the error message might find my answer useful.

Emacs Helm (anything): Desired candidates are excluded for autocompletion. Why?

I have a file in my home directory called .gitconfig. When I try to open this file with Emacs with helm-mode activated, this file is eventually unmatched, as I type it.
In the minibuffer I start typing the path (C-x C-f)
Find file: /home/.g
and it shows me:
.gconf
.gitconfig
.gnome2-private
etc.
However, as soon I type i (i.e. typing /home/.gi to eventually type .gitconfig), Helm removes .gitconfig from the autocompletion list and leaves me with .gnome2-private.
Why does this happen? How can I have Helm never exclude a file from the current directory where I am hoping to open a file?
I cannot reproduce this after recreating the directory structure you specified.
If you clone the helm github repo found here, then execute
./emacs-helm.sh, does it still repro? If not, can you add back your
config until it does? This would be a bug.
Also, it would be best to file a helm issue and discuss it there.

emacs why do I have hashes at the ends of my file names i.e. #test.c#

I am using emacs 22.2.1 on Ubuntu 9.04.
Every time I open a file and work on it, and then when I list the files in the directory in the terminal I see hashes at the ends of each file.
i.e.
#test.c#
#test.h#
Why is this and how can I remove them?
Many thanks for any advice,
It's a backup (autosave) file. Emacs should remove them when it finishes editing the file, unless it dies or you kill it without saving the files. It's better not to remove these files since if you do, you cannot recover if Emacs should crash for some reason. When you start Emacs again you can recover the file with M-x recover-this-file to recover it from the backup.
These are autosave files.
Have a look at this link to change the files to be in a different directory.
Have a look at this
You have encountered the feature named "autosave". It saves modified buffers that have not been saved by the user for a while.
I have seen people disable it or change the location of the autosaved buffers to a temporary directory. You can also get more info there, for instance.
Emacs performs a timely backup so you can always have the changes you've made (minus the last 5 minutes of your work) in case of a crash. You can remove it by this command from your working directory rm #*
It's a recovery file that emacs creates when you haven't saved your file in a while (but only if it contains unsaved text). As soon as you save your file the recover file is removed. If emacs should crash before you can save, the file can be recovered with M-x recover-file.
Instead of removing these autosave files, I recommend placing them in a hidden directory. They are cheap insurance against data loss.
On Emacs 28 running on Ubuntu linux, I have the following lines in my ~/.emacs config file:
(setq auto-save-file-name-transforms `((".", "~/.emacs-saves" t)))
Additionally, I use this to move the backup files (Those that look like filename~) as well:
(setq backup-directory-alist `(("." . "~/.emacs-saves")))
(setq backup-by-copying t)
Note that you might have a different config file location, this is perfectly fine. If you find ~/.emacs does not exist, then try ~/.emacs.el, ~/.emacs.d/init.el, or ~/.config/emacs/init.el.