Bookmark+ using a temporary file, despite having asked for a specific file - emacs

After typing C-x r l I get a buffer called *Bookmark List*
In this buffer I see:
Bookmark file:
/tmp/bmkp-temp/19236bkt
If I open help (i.e. press h), I see:
Bookmark file: /tmp/bmkp-temp-19236bkt
Sorted:
Filtering: none
Marked: 0
Omitted: 0
Autosave bookmarks: no
Autosave list display: yes
This is even though I have the following in my .emacs file:
(setq bookmark-file "~/.emacs.d/bookmarks")
(setq bookmark-default-file "~/.emacs.d/bookmarks")
(setq bmkp-default-bookmark-file "~/.emacs.d/bookmarks")
(setq bmkp-last-as-first-bookmark-file nil)
Why is it using a different bookmark file from the one I specified?
I also noticed that when I load Emacs the following happens:
Emptying bookmark file `/tmp/bmkp-temp-23808OMn'...
Saving file /tmp/bmkp-temp-23808OMn...
Wrote /tmp/bmkp-temp-23808OMn
Emptying bookmark file `/tmp/bmkp-temp-23808OMn'...done
...
Helm completion enabled
Emptying bookmark file `/tmp/bmkp-temp-23808bWt'...
Saving file /tmp/bmkp-temp-23808bWt...
Wrote /tmp/bmkp-temp-23808bWt
Emptying bookmark file `/tmp/bmkp-temp-23808bWt'...done
...
Emacs goes on a spree deleting temporary bookmark files. ?

Perhaps you were trying to use "bookmark-file bookmarks"? Or anyways, accidently hit C-x p x?
These are claimed to correspond, at EmacsWiki: Bookmark Plus / Bookmark-File Bookmarks, where they say, "bmkp-set-bookmark-file-bookmark, bound to C-x p x". For my Emacs, this is not true.
By typing C-x p C-h, I can check key-bindings that start with C-x p. I find
C-x p x is bound to bmkp-toggle-autotemp-on-set, and
C-x p y is bound to bmkp-set-bookmark-file-bookmark.
Then, the link should say C-x p y instead.

It looks like something, somewhere (e.g. check your .emacs file) has turned on bmkp-temporary-bookmarking-mode. When that mode is on, any bookmarks you create are for the current session only -- they are not saved to your bookmark file.
And that means that your bookmark-file location settings are ignored. (Note, BTW, that bmkp-default-bookmark-file is a function, not a variable -- it is not something that you set. And you don't need all of those bookmark-file settings; some are redundant: old names from old versions of Emacs bookmarking.)
I don't know why you are getting multiple temporary bookmark-file creations and saves. You didn't provide a complete recipe. You should get only one such. This is all I see in *Messages* in this regard, for instance:
Emptying bookmark file `c:/DOCUME~1/me/LOCALS~1/Temp/bmkp-temp-5348su1'...
Saving file c:/Documents and Settings/me/Local Settings/Temp/bmkp-temp-5348su1...
Wrote c:/Documents and Settings/me/Local Settings/Temp/bmkp-temp-5348su1
Emptying bookmark file `c:/DOCUME~1/me/LOCALS~1/Temp/bmkp-temp-5348su1'...done
It also appears that you have a lot of stuff going on (Helm etc.). When trying to understand or debug a problem, it helps to narrow things down as much as possible. Who can tell what other interactions might be involved here?
All of that said, my advice would be to not start out using the temporary bookmarking mode. I would not suggest you use that until you are quite familiar with Bookmark+. You can use temporary bookmarks without using this mode.
Here is the doc about using temporary bookmarks:
http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus#toc55
Finally, as Stefan suggested, please follow up by email. It's a lot easier for debugging/discussing things in detail.
Thx -- Drew
Update 2019-04-21:
I think what might have happened is that you quit Emacs with bmkp-temporary-bookmarking-mode enabled. Although Bookmark+ (correctly) does not save the file of temporary bookmarks it was not preventing the recording of bmkp-last-as-first-bookmark-file from being updated to point to the temporary file. In your next Emacs session that temporary file (if it still existed) was loaded because of bmkp-last-as-first-bookmark-file.
That should be OK now. Enabling bmkp-temporary-bookmarking-mode now resets bmkp-last-as-first-bookmark-file to nil, so if you quit with the temp mode still enabled, then when you load your bookmark file in a new session the file that is read is the value of bookmark-default-file. (The value of bookmark-default-file is never changed, except by your
customizations.)

It's quite an old question, but since I had just the same problem and the other answers didn't help me I'll post my solution:
I'm using desktop files from desktop.el and the temporary mode was set there in the desktop file! Removing that setting from all my desktop files fixed the problem.
This might be handy:
find ~ -name .emacs.desktop -print0 | xargs -0 grep -l bmkp-temporary-bookmarking-mode

Related

Emacs - How do I get projectile to open file in current window?

I've spent a whole day on this now. Say I open emacs and press C-c p p to open projectile-switch-project then RET to select a project, emacs opens a new window horizontally (on top of the previous) with the current buffer.
What I need is for projectile to use the already existing window and not open a new one. I've gone through every single line of my config and can figure out what is causing it.
I'd have posted my config but it's split over multiple files which will make it impractical to link to here.
The related packages I can think of which I use are:
projectile,
ivy swiper counsel - trilogy
What I've tried so far is start emacs without loading (ivy swiper counsel) and also I've tried replacing all my projectile code with bare minimum:
(use-package projectile
:ensure t
:init
(projectile-mode +1)
:bind (:map projectile-mode-map
("s-p" . projectile-command-map)
("C-c p" . projectile-command-map)))
which didn't work either.
I'm not expecting any specifics since it's a hand crafted config however I'm hoping for general pointes as to where to look for the possible cause.
I'm researching more to see if i can find a better way for you, but this is what i have so far...
If you want to look around the customization options just type M-x customize. I found a ton of options you can browse through. Projectile was listed under "Convenience" and frames/windows were listed under "Environment". You can also search packages you might be interested in for more customization if you have MELPA installed.
Considering the way that buffers and windows work I don't think you can just replace the content inside the buffer with the content of another file. I think (or at least how I've been using Emacs) you will always open a new buffer to open a file and close old buffers if needed.
From what I was reading, buffers are like interfaces between Emacs and the file you're peering into. It sets up a connection, points to the file, and creates a name for the buffer (usually from the file name unless you change it). Something I find interesting is you can even have multiple buffers open to the same file and as you type on the screen in one buffer the text should show up in the other buffer in real time.
I was reading some documentation on it and I think the command you're looking for is C-x C-f or C-x d, which opens DiredMode. The first one opens your home directory and the second opens the current directory for the file in your selected buffer. This will open a mini-buffer to search through files and when you choose the file it should open the file in a new buffer on top of the buffer you were looking at initially.
Then you can use C-x b to list and move between other buffers that are already open.
Also, M-x projectile-find-file is a command you can use to search files and get the same outcome. I don't have that set to a key-binding so I don't know if there is a default, plus I'm using Spacemacs with evil-mode, so not everything is the same as original Emacs.
Also, maybe look into extension you can get from MELPA like Treemacs

Force DocView mode to show updated file without confirmation?

I use DocView Mode to display .pdf compilations via "latex-preview-pane-mode." Recently, Emacs will ask me "file ____.pdf changed on disk. Reread from disk? (yes or no)".
Typing "yes" each time disrupts my workflow. I have tried setting auto-revert-mode for the DocView buffer, but this did not help. Is there any way to fix this, or any idea why it changed suddenly (no changes to my .emacs.d in the recent past).
To achieve what Tristan suggests, first I tried M-x customize-variable RET revert-without-query, but couldn't get very far, so I wrote this in my init.el file:
(setq revert-without-query '(".pdf"))
and I'm happily udating my pdf files from org-mode without getting queried every time. (I use pdf-tools).
Source: fourth answer to a similar question in stackoverflow
(defun revert-buffer-no-confirm ()
"Revert buffer without confirmation."
(interactive)
(revert-buffer :ignore-auto :noconfirm))
Source: http://www.emacswiki.org/emacs-en/download/misc-cmds.el
Maybe this function could help you out
Take a look at the variable revert-without-query. From the Emacs Lisp documentation:
This variable holds a list of files that should be reverted without
query. The value is a list of regular expressions. If the visited
file name matches one of these regular expressions, and the file
has changed on disk but the buffer is not modified, then
‘revert-buffer’ reverts the file without asking the user for
confirmation.
Adding .+\.pdf to the list should make buffers visiting pdf files revert when you change the file on disk.

Is it possible to prevent emacs from creating " .#files " [duplicate]

When I modify a buffer, Emacs automatically creates a temporary symlink in the same directory as the file being edited (e.g. foo.c):
.#foo.c -> user#host.12345:1296583136
where '12345' is Emacs' PID (I don't know what the last number means).
Why does Emacs create these links, and how do I prevent it from doing that?
Note that I have turned off auto save mode (M-x auto-save-mode) and disabled backup files (M-x set-variable -> make-backup-files -> nil). When I save a modified buffer, or undo the changes to it, the symlink disappears.
In particular, I'm trying to prevent Emacs from creating these links because they cause the directory timestamp to be modified, which causes our build system to rebuild an entire module instead of compiling and linking for one changed file :/
Thanks for any input!
Update: In order to prevent Emacs from creating interlocking files permanently, you can change src/filelock.c and build a custom binary:
void
lock_file (fn)
Lisp_Object fn;
{
return;
// Unused code below...
}
Update 2: Arne's answer is correct. It's now possible to disable lock files in the latest Emacs (24.3.1), by adding this to your .emacs file:
(setq create-lockfiles nil)
Update: Emacs 24.3 has been released with full support for this new setting!
In the current trunk of emacs, you can simply customize the variable create-lockfiles:
C-h v create-lockfiles
Documentation:
Non-nil means use lockfiles to avoid editing collisions.
In your init file, you can set
(setq create-lockfiles nil)
Get it via
bzr branch bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk
make
src/emacs
(I found out about this, because I decided to get active and just add an option like that myself… :) )
The symbolic link is emacs' file interlocking system: the symbolic link indicates that an instance of emacs is editing this file. If another instance tries to edit the same file, emacs will issue a warning. See http://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html
This has nothing to do with auto-save.
I cannot find how to modify or disable file locking from within emacs.

How can I open a file in subfolder in dired mode fast?

In dired mode, how can i open the file fastly in the subfolder? I found that after loading dired+', the key 'j' isdired-goto-file'. But I cannot use it in the emacs 24 + Windows 7.
Is there any convenient key to open/find the file in subfolder fast?
thanks.
Personally, I recommend using isearch when you're finding something in a buffer, including dired. I find that the incremental search really help and efficient after I get familiar with it.
You can take a look at 10 Specific Ways to Improve Your Productivity With Emacs. It's tip 4.
As he said:
"It's difficult to overemphasize how powerful this technique is, once you've mastered it."
Your question is not clear to me.
In Dired (including for Dired+), j prompts you for a file name and moves the cursor to that file name in Dired. Does it not do that for you? You say that you cannot use it in Emacs 24 and Windows 7. I use it in Emacs 24 and Windows 7 (and with Dired+) all the time, with no problem.
Please provide more info. What happens when you use j?. What did you expect to happen, and what really happens?
But you speak about "opening" the file. That is not what j does. It is what RET does, when the cursor is on the file name. Does that not work for you?
Perhaps you just want to open a file after being prompted for its name? For that, just use C-x 4 f or C-x C-f.
Not clear. But depending on what you really want, perhaps the answer is here: j, RET, or C-x 4 f.
I think I can understand the question. The platform should not matter.
Pressing j provides the current directory string in the mini-buffer,
making it convenient to write a file-name and tab-complete it. When that
file-name is a sub-directory of the dired directory, one can find files
in that sub-directory.
Now, if a file in that sub-directory is selected and you press RET,
minibuffer informs that mark set, and point stay foot.
I tried C-x C-SPC (pop-global-mark) to see if I would be jumped to
the file found in another buffer, but not so. The mark was set at point.
So this provides no answer but in best case a clarification of the
original question. I could agree it would be nice to be jumped with point on that file in the sub-directory.
I stumbled into this because I wondered what j does in dired mode,
pressing it by mistake.
even though i don't use dired mode,
i just tried dired and j and the mini buffer prompts me the file to open. I use lusty mode for files and buffers. but you can use
open-dribble-file
to open a file from a location

In Emacs, how can we go to another file already found by the previous dired-find-name / findr.el?

This is in accordance to question Using Emacs to recursively find and replace in text files not already open. I already tried using find-name-dired and also package findr.el. It did open a file where the matching text found, but... how can I go to another file, not this automatically opened file????
Thank you!
This seems like more than one question.
find-name-dired will create a results buffer listing all the files with matching filenames. Use C-h m to see dired-mode's help, and all its key-bindings. RET will open the file at point, o will open the file at point in another window, and C-o will do the same, but leaves you in the Find window (which is convenient if you want to quickly visit several of those files).
findr-search (which is what it sounds like you're using) appears to work more like a tags mechanism. C-h f findr-search RET says that you can navigate to the next match with M-,. This will cycle through the matches in the current file, and then on to the next file as necessary.