dired

Emacs Dired Behavior

空扰寡人 提交于 2019-12-04 11:59:40
I have used emacs for years and am accustomed to having emacs open a selected file in the same window that dired is executed in. In recent revisions, when dired is executed with say 2 windows open, the file selected will be displayed in the alternate window from dired. How can I set up emacs to use the same window to display the file as died (allowing me to look at two files simultaneously--the way emacs used to work)? As per the comments above, check C-h k RET when in dired to see what RET is bound to (or similarly if you are using another key). dired-find-file uses switch-to-buffer which

How to get Dired to ignore files with specific extensions

五迷三道 提交于 2019-12-04 03:03:50
问题 I put the following in my .emacs file: (require 'dired-x) (add-hook 'dired-load-hook '(lambda () (require 'dired-x))) (setq dired-omit-files-p t) (setq dired-omit-files (concat dired-omit-files "\\|^\\..+$\\|-t\\.tex$\\|-t\\.pdf$")) But C-x d still shows me .pdf and .tex files. Did I get the syntax wrong in that last line? Bonus question: Is there a way to get Dired to hide hidden directories, like .git folders? 回答1: Your regexp will match *-t.tex files, not *.tex ones. With recent version of

How to [tar and] compress marked files in Emacs

我只是一个虾纸丫 提交于 2019-12-03 12:45:40
In dired+ in Emacs 23.2.1 on a Debian Squeeze variant I selected four files with * and then pressed Z to compress them. I answered y to the prompt and saw some status updates in the mini-buffer. Where do I find the compressed file? I tested on one file ( C-u Z ) and Emacs ran gzip on the one file and made it a .gz file. How do I [tar and] compress marked files in Emacs? (To preempt any philosophical or methodological discussions about tar, gzip, other formats and archives in general, all I want is the four files to be stored in one file as compressed data. If that can be achieved via tar and

Emacs Dired rename many files

余生长醉 提交于 2019-12-03 04:52:22
问题 How to rename from: VAR1_1F_text.txt VAR2_1F_text.txt VAR3_2F_text.txt to 1F_VAR1_text.txt 1F_VAR2_text.txt 2F_VAR3_text.txt How to switch parts of filenames? 回答1: This can easily be done using dired : Enter a dired view of your directory Switch to writable dired mode ( wdired-change-to-wdired-mode ): C-x C-q Edit the file names listing as if it were a normal buffer (for example using a keyboard macro or a rectangular selection or query-replace). Here is a regexp-based solution: C-M-% \(VAR.\

Emacs Dired rename many files

喜你入骨 提交于 2019-12-02 18:04:29
How to rename from: VAR1_1F_text.txt VAR2_1F_text.txt VAR3_2F_text.txt to 1F_VAR1_text.txt 1F_VAR2_text.txt 2F_VAR3_text.txt How to switch parts of filenames? This can easily be done using dired : Enter a dired view of your directory Switch to writable dired mode ( wdired-change-to-wdired-mode ): C-x C-q Edit the file names listing as if it were a normal buffer (for example using a keyboard macro or a rectangular selection or query-replace). Here is a regexp-based solution: C-M-% \(VAR.\)_\(..\) RET \2_\1 RET Finish editing ( wdired-finish-edit ): C-x C-s or C-c C-c You're done! You could also

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

我们两清 提交于 2019-12-02 05:18:57
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-filename (working-buffer (buffer-name))) (if directory (dired directory) (dired nil)) (if save-as-buffer

How to get Dired to ignore files with specific extensions

痴心易碎 提交于 2019-12-01 16:12:27
I put the following in my .emacs file: (require 'dired-x) (add-hook 'dired-load-hook '(lambda () (require 'dired-x))) (setq dired-omit-files-p t) (setq dired-omit-files (concat dired-omit-files "\\|^\\..+$\\|-t\\.tex$\\|-t\\.pdf$")) But C-x d still shows me .pdf and .tex files. Did I get the syntax wrong in that last line? Bonus question: Is there a way to get Dired to hide hidden directories, like .git folders? Your regexp will match *-t.tex files, not *.tex ones. With recent version of Emacs, it should be sufficient to add the following section to ~/.emacs to filter what you want: (require

Dired - open files in another Emacs window

眉间皱痕 提交于 2019-11-30 01:25:51
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? event_jr 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 the same thing. 来源: https://stackoverflow.com/questions/9972519/dired-open-files-in-another-emacs

Emacs dired: too much information

烈酒焚心 提交于 2019-11-28 21:17:04
I'm trying to use Emacs and everything is fine, but the information about every file in my directory is too comprehensive. How can I tell it to show only file name (and maybe filesize in human readable format)? I tried options like dired-listing-switches but without any luck. You can reduce the amount of information displayed by using Emacs' ls emulation instead of allowing it to use ls directly. To enable ls emulation, add the following code to your startup file (probably .emacs or .emacs.d/init.el): (require 'ls-lisp) (setq ls-lisp-use-insert-directory-program nil) You can then customise the

How do I create an empty file in emacs?

纵然是瞬间 提交于 2019-11-28 16:57:11
How can I create an empty file from emacs, ideally from within a dired buffer? For example, I've just opened a Python module in dired mode, created a new directory, opened that in dired, and now need to add an empty __init__.py file in the directory. If I use C-x C-f __init__.py RET C-x C-s then emacs doesn't create the file because no changes have been made to it. I would have to type in the file, save it, delete my typing and then save it again for that to work. Thanks Here's an adaptation of dired-create-directory . It works the same way, so as well as a plain filename, you can also specify