dired

Open dired and select the file associated with the previous buffer?

送分小仙女□ 提交于 2020-02-02 01:53:52
问题 Let's say I am editing blah.txt with Emacs and I decide to open dired to rename the file blah.txt. When I press C-x d RET (or C-x C-f RET ), a dired buffer will show up to display the content of the directory containing blah.txt , but the cursor will not be on blah.txt . So I need to search my file first ( C-s blah.txt ) to place my cursor on it and then I can rename it ( R ). How do I automate or remove the step C-s blah.txt ? 回答1: dired-jump is exactly what you want. (autoload 'dired-jump

dired-read-file-name: pop-up dired mode to read-file-name

陌路散爱 提交于 2020-01-21 23:50:11
问题 Could anyone please give me a hand to briefly pop-up a dired buffer for the purposes of read-file-name : (defun dired-insert-file () (interactive) (setq filename (dired-read-file-name "~/Desktop")) (kill-buffer dired) (get-buffer-create "*foo*") (set-buffer "*foo*") (insert-file filename)) EDIT : Revised example: (require 'dired) (defvar open-with-variable nil) (defvar save-as-variable nil) (defvar save-as-buffer-filename nil) (defun dired-read-file-name (&optional directory) (let* ( output

dired-read-file-name: pop-up dired mode to read-file-name

♀尐吖头ヾ 提交于 2020-01-21 23:46:52
问题 Could anyone please give me a hand to briefly pop-up a dired buffer for the purposes of read-file-name : (defun dired-insert-file () (interactive) (setq filename (dired-read-file-name "~/Desktop")) (kill-buffer dired) (get-buffer-create "*foo*") (set-buffer "*foo*") (insert-file filename)) EDIT : Revised example: (require 'dired) (defvar open-with-variable nil) (defvar save-as-variable nil) (defvar save-as-buffer-filename nil) (defun dired-read-file-name (&optional directory) (let* ( output

Emacs, Dired+. What mean one dot in dired mode?

青春壹個敷衍的年華 提交于 2020-01-17 08:43:31
问题 Window 7, Emacs 25.1, Dired+ mode. Path: d:\temp\test\test2\test3\ In folder test3 has 3 files: file1.txt, file2.txt, file3.txt. When I am in folder test3 and click on two dots I'm up to one level (go to folder test2 ). OK. But when I click on one dot (see picture) the cursor go to on file file1.txt . 1.Is this a correct behavior? 2.What mean one dot in dired mode? 回答1: I would say this is correct behavior. In directory listings the single dot usually represents the current directory. You can

Dired - open files in another Emacs window

↘锁芯ラ 提交于 2020-01-10 07:52:04
问题 I want to have two Emacs windows on the screen: one for Dired and one for code. But when I click on a file in the Dired buffer the file opens in the the same window, in place of the Dired buffer. Can I change this behaviour? 回答1: Why are you clicking on things with a mouse? I thought you're using Emacs? Move point to the line you're interested in and press o to open it in another window or C-o to open the file but stay on Dired buffer. If you must do it with the mouse, use middle-click to do

Value of the dired-directory

只愿长相守 提交于 2019-12-20 01:40:55
问题 I wanted to run a script in the location of the current buffer, or, if it is a dired buffer - to run the script on the current dired directory. The current dired directory seems to be stored in dired-directory variable. Indeed it is - but when I try to make use of it - it sometimes gives me the previous dirs instead of the current one: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (let ((curDir (if (memq major-mode '(dired-mode sr-mode)) dired-directory (if (buffer-file-name)

Distinguishing files with extensions, from hidden files and no extensions

旧城冷巷雨未停 提交于 2019-12-17 17:11:36
问题 I'm having difficulty distinguishing files with extensions, from files without extensions, and hidden files. I'm using (file-name-extension (dired-get-file-for-visit)) in dired-mode, and the type of file extension determines what action to take -- e.g., open in Emacs, or open externally with a particular application. A hidden file (e.g., .hidden ) returns a value of nil instead of "hidden" . A file with no extension (e.g., foo ) also returns a value of nil . Can anyone suggest an alternative

Is it possible to use align-regexp in wdired mode (Emacs)?

拥有回忆 提交于 2019-12-13 02:00:50
问题 Is it possible to use align-regexp in wdired mode (Emacs)? I want to align folder names that contain a space after the first word. So: folder1xxx xxxxx folder2xx xxxxxx folder3xxxx xxxxx where x can be any alphanumeric character, should become something like this: folder1xxx xxxxx folder2xx xxxxxx folder3xxxx xxxxx As of now I only get a 'Text is read-only' message, because not the whole buffer is editable. Thanks. 回答1: A possibility is to select the filenames by putting the mark on the first

Emacs: Is it possible to list all matching lines for a certain query string for marked files in dired?

假如想象 提交于 2019-12-10 16:14:47
问题 I found out M-x occur the other day. (How to achieve code folding effects in Emacs?) I wonder if I could list all matching lines in multiple files(or buffers) preferably marked in dired mode. 回答1: M-x multi-occur M-x multi-occur-in-matching-buffers and also: M-x multi-occur-in-this-mode (defun get-buffers-matching-mode (mode) "Returns a list of buffers where their major-mode is equal to MODE" (let ((buffer-mode-matches '())) (dolist (buf (buffer-list)) (with-current-buffer buf (if (eq mode

How do I hide number of links in dired?

痞子三分冷 提交于 2019-12-07 23:58:12
问题 99.9% of the time, I don't care how many links are pointing to a file. How do I get dired (or alternatively, ls) to not display the number of links? For reference, the output of ls -l is something like: -rw-rw-rw- 1 root dir 104 Dec 25 19:32 file The number of links, in this case, is 1. ls has a flag to remove the group number (104) but not one to remove the number of links, from what I can tell. I'm afraid editing the format will screw up dired's parsing, as ls has a special flag for