This page is about package Dired+ (library dired+.el), which extends functionalities provided by standard GNU Emacs libraries
dired-x.el. The standard functions are all available, plus many more.
For help about Dired+ you can use
‘C-h m’) in DiredMode, or
‘M-x diredp-dired-plus-help’ anywhere.
Here are some of the things Dired+ does:
‘C-x 4 d’(
‘*-other-window’). They do the same thing as usual except when given a non-positive prefix arg. In that case, you can enter any number of files or dirs, and a Dired buffer is created for just those files and dirs. (And on MS Windows, you can use wildcards in those names – see If You Use Emacs on MS Windows.)
‘C-u C-u’. Especially useful in Dired buffers with files from multiple directories. Use
‘C-u C-u M-g’to
‘C-u C-u C’to copy all files, and so on. Use
‘C-u C-u C-u’to operate on all directories as well as all files.
‘*-other-window’) to create a Dired buffer that is the union of selected existing Dired buffers. That is, the new Dired buffer contains all of the files and subdirs listed in the Dired buffers you choose. The selected Dired listings are included in the order you choose them, and each entry is listed only once in the new Dired buffer. The new Dired listing respects the markings, subdirectory insertions, and hidden subdirectories of the selected Dired listings.
‘*Bookmark List*’for those marked-file bookmarks (only).
‘mouse-3’. The menu differs, depending on whether or not a region is active in Dired.
completion-ignored-extensions) are in a subdued face; other files stand out more. To hide less important files altogether, use
‘M-o’(it’s a toggle) – see DiredOmitMode.
Here is a screenshot of Dired+, showing highlighting and the
‘mouse-3’ menu when a region is active.
Things to notice in this screenshot:
TESTS NOV 13)
New PSGML Doc.htm,
TESTS NOV 13)
If you also use library mouse3.el then you can choose to use its popup menu, which is specially adapted for Dired, whenever there is an active region, rather than the simpler menu shown above. Here is a screenshot.
You can try
mouse3.el if you want to see what is in each of the submenus. I’ll just mention that the first one (Dired by name in the screenshot) duplicates the complete Dired menu-bar, so you don’t really need to show the menu-bar at all. The others provide various operations on the selected (region) files.
Coming back to just Dired+ (with or without mouse3.el), here is a screenshot showing that the entire line is highlighted on mouse-over, regardless of where on the line the mouse is. Click
‘mouse-2’ anywhere on the line to open its file or directory.
I found this full-line mouse-over highlighting so useful as a visual alignment aid in tabular buffers such as Dired that I implemented it generally, for use in any buffer (but only on demand). So, even if you do not use Dired+, you can still obtain the advantage of this highlighting, at the cost of holding down the Shift key. (This highlighting is only a visual aid; it does not affect what happens if you click
‘mouse-2’ on the highlighted line.) Just bind
‘mouse-scan-lines’ (or, better, `
mouse-scan-lines-or-M-:’), in library mouse+.el, to
‘S-down-mouse-2’. See MousePlus. – DrewAdams
And here is a screenshot showing the
‘mouse-3’ popup menu available when no region is active – the menu items apply to the file pointed to:
(Some of the menu items shown here are available onlyif you also use Bookmark+.)
‘dired’. This lets you open Dired on an explicit list of arbitrary files using wildcard patterns for any of the file names. (Emacs 23+ only)
‘M-RET’) You can use Windows file associations to act on a file or folder. For example, if you have the application Adobe Acrobat associated with *.pdf files, then clicking
‘C-RET’) You can open Windows Explorer on a file or folder. If a file, its containing folder is opened and the file is selected (in Windows Explorer).
^’) When at the root of a Windows drive (e.g. `
C:/’) and you use `
‘dired-up-directory’), you get a list of drives to choose from. (This feature is based on the contribution at WThirtyTwoBrowseNetDrives.)
See these wiki pages for related features.
space used 49439 available 56233408
Here are screenshots of the various Dired+ menus. Using the menus is a good way to learn some of the features (and their key bindings).
‘mouse-3’ pops up a menu, which can take two forms, depending on whether the region is active. If so, the menu items act on the files and directories in the region. If not, the menu items act on the file or directory you pointed to when you clicked
If you use Icicles then this has an Icicles submenu:
If you use DiredSortMenu then it has a Sort By submenu, which has its own submenus (not shown here):
The Mark menu has a Tagged submenu:
If you use MenuBarPlus then this menu is called Multiple.
If you use Icicles then this has an Icicles submenu:
If you use MenuBarPlus then this menu is called Single.
I found a bug of this useful extension. I’m using the latest dired+, Last-updated: Sun Jan 31 14:06:37 2010 (-0800). The font-lock for date and time invades the area for size of file. My settings for the test are very simple. – KiwonUm?
> emacs -Q or emacs -Q -nw M-x version : GNU Emacs 220.127.116.11 (i686-pc-linux-gnu, GTK+ Version 2.16.6) ... (add-to-list 'load-path "~/.emacs.d") (require 'dired+)
I don’t see that. Please provide more info about your settings, or at least a screenshot. Thx – DrewAdams
Here is the screenshot:
Are you using the latest version of Dired+? If not, please download it and try it: dired+.el. I ask because (1) I don’t see your file size highlighted at all, and (2) your face for the date+time is not the default face (in the latest version), yet you say that you used
emacs -Q (so the default faces should be shown). And the only default face for a filename that has a red foreground is for a file flagged
‘D’. I see no way that your date+time could be red.
Also, your Emacs version is something I don’t recognize. It is a development version that is different from the current pretest. It’s possible they have changed something recently in the Dired code. Can you test using a different Emacs version – perhaps download Emacs 23.1 and try with that?
The fontification of the date+time and for the file name are done using the same regexp, the value of
‘dired-move-to-filename-regexp’. What is your value of that variable? Dunno if I can help much, I’m afraid. That’s a very hairy regexp. I would start by trying to figure out why your file size is not getting fontified. – DrewAdams
Sure. I’m using the latest dired+.el, last-updated: Sun Jan 31 14:06:37 2010 (-0800). And the screenshot was taken from xterm (emacs -Q -nw), so the color might be red. In GUI emacs (emacs -Q), the color is the same with the default color what you expect, but the problem persists.
My emacs version is the latest bzr updated, it’s exactly development version of emacs. Let me try it with the other version of emacs soon.
The ‘dired-move-to-filename-regexp’ value is so hairy that I cannot copy&paste here. Instead, let me put a screenshot. ;)
– Kiwon Um
OK, understood. I suspect it is because of some change they’ve made to the development version. I can’t really do much about this until I have such a version. And even then it’s not easy to decipher that regexp and make the right changes – but at least I’ll be able to experiment. For now, the most important help will be for you to confirm that it works OK for you with a release version (e.g. 23.1). That will at least tell me where the problem is, in general. And if it’s not OK for you in 23.1, then we can try to investigate further. Sorry for your trouble.
BTW, I already see that that regexp has changed considerably. This is the value I have from the Emacs pretest 23.1.92:
What is the value of variable
‘dired-actual-switches’ in the Dired buffer? It’s weird that your listing shows a period, `
.’, after the file permissions. Perhaps that is something new and it throws off some of the regexps.
However, I just downloaded the latest development
dired.el, and it is identical to the version in 23-1-92, which is the pretest I use. Of course, that regexp is defined in file
files.el. I’ll take a look there also.
It could also be a difference of platforms. I use Windows, which uses
ls-lisp.el – the
‘ls’ listing software is different. But I don’t recall seeing that `
.’ before, even on UNIX/Linux. Any idea what it represents?
Another thing you can try is to use
‘C-u C-x d’ and specify various different switches, to see what happens. Let me know about your switches (see above).
Just for fun, another thing you can try is to evaluate this, to change back to the regexp used in 23.1.92, and see if that “fixes” the problem. If so, that will confirm that the problem is to adapt the code to the new regexp you have:
(setq directory-listing-before-filename-regexp (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)") (l-or-quote "\\([A-Za-z']\\|[^\0-\177]\\)") (month (concat l-or-quote l-or-quote "+\\.?")) (s " ") (yyyy "[0-9][0-9][0-9][0-9]") (dd "[ 0-3][0-9]") (HH:MM "[ 0-2][0-9][:.][0-5][0-9]") (seconds "[0-6][0-9]\\([.,][0-9]+\\)?") (zone "[-+][0-2][0-9][0-5][0-9]") (iso-mm-dd "[0-9]-[0-3][0-9]") (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?")) (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time "\\|" yyyy "-" iso-mm-dd "\\)")) (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)" s "+" "\\(" HH:MM "\\|" yyyy "\\)")) (western-comma (concat month s "+" dd "," s "+" yyyy)) (mm "[ 0-1]?[0-9]") (east-asian (concat "\\(" mm l "?" s dd l "?" s "+" "\\|" dd s mm s "+" "\\)" "\\(" HH:MM "\\|" yyyy l "?" "\\)"))) (purecopy (concat ".*[0-9][BkKMGTPEZY]?" s "\\(" western "\\|" western-comma "\\|" east-asian "\\|" iso "\\)" s "+"))))
I’ve now compared the new regexp value with the old. Essentially, the new regexp just has an extra level of grouping (parens). I don’t have a real understanding yet, but try this, just for the heck of it:
In dired+.el, find the
‘diredp-font-lock-keywords-1’. Copy the defining sexp, which starts with
(list '("^ \.+:\\)$"..., and paste it into buffer
diredp-font-lock-keywords-1 in front of it and add a
) after it. Change this:
(list dired-move-to-filename-regexp '(1 diredp-date-time t t)...
(list dired-move-to-filename-regexp '(2 diredp-date-time t t)...
Then put the cursor after the overall sexp and hit
‘C-x C-e’ to evaluate it. Who knows? Maybe that’s all that’s needed. ;-)
It’s likely, however, that the extra level of parens in the new regexp will require adjusting several of the other elements of
‘diredp-font-lock-keywords-1’ the same way. If that first test makes a positive difference, then you can try incrementing each of the other font-lock regexp indexes by one as well, to see the effect. – DrewAdams
Oh my god! You wrote a lot during I were testing your code. :) The
‘dired-actual-switches’ value is “-al”. And I have no idea about the period. My system is Linux Fedora 11. Then if it is really problematic, it shouldn’t work well in emacs 23.1 either, but it works fine there. As you advised above, after evaluating the following codes, the invasion get disapeered.
(add-to-list 'load-path "~/.emacs.d") (require 'dired+) (setq directory-listing-before-filename-regexp (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)") (l-or-quote "\\([A-Za-z']\\|[^\0-\177]\\)") (month (concat l-or-quote l-or-quote "+\\.?")) (s " ") (yyyy "[0-9][0-9][0-9][0-9]") (dd "[ 0-3][0-9]") (HH:MM "[ 0-2][0-9][:.][0-5][0-9]") (seconds "[0-6][0-9]\\([.,][0-9]+\\)?") (zone "[-+][0-2][0-9][0-5][0-9]") (iso-mm-dd "[0-9]-[0-3][0-9]") (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?")) (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time "\\|" yyyy "-" iso-mm-dd "\\)")) (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)" s "+" "\\(" HH:MM "\\|" yyyy "\\)")) (western-comma (concat month s "+" dd "," s "+" yyyy)) (mm "[ 0-1]?[0-9]") (east-asian (concat "\\(" mm l "?" s dd l "?" s "+" "\\|" dd s mm s "+" "\\)" "\\(" HH:MM "\\|" yyyy l "?" "\\)"))) (purecopy (concat ".*[0-9][BkKMGTPEZY]?" s "\\(" western "\\|" western-comma "\\|" east-asian "\\|" iso "\\)" s "+")))) (setq diredp-font-lock-keywords-1 (list '("^ \\(.+:\\)$" 1 diredp-dir-heading) ; Directory headers '("^ wildcard.*$" 0 'default) ; Override others, e.g. `l' for `diredp-other-priv'. '("^ (No match).*$" 0 'default) ; Override others, e.g. `t' for `diredp-other-priv'. '("[^ .]\\.\\([^. /]+\\)$" 1 diredp-file-suffix) ; Suffix '("\\([^ ]+\\) -> [^ ]+$" 1 diredp-symlink) ; Symbolic links ;; 1) Date/time and 2) filename w/o suffix: (list dired-move-to-filename-regexp '(1 diredp-date-time t t) ; Date/time (list "\\(.+\\)$" nil nil (list 0 diredp-file-name 'keep t))) ; Filename ;; Files to ignore (list (concat "^ \\(.*\\(" (concat (mapconcat 'regexp-quote (or (and (boundp 'dired-omit-extensions) dired-omit-extensions) completion-ignored-extensions) "[*]?\\|") "[*]?") ; Allow for executable flag (*). "\\|\\.\\(g?z\\|Z\\)[*]?\\)\\)$") ; Compressed. 1 diredp-ignored-file-name t) '("[^ .]\\.\\([bg]?[zZ]2?\\)[*]?$" 1 diredp-compressed-file-suffix t) ; Compressed (*.z) '("\\([*]\\)$" 1 diredp-executable-tag t) ; Executable (*) '(" \\([0-9]+\\(\\.[0-9]+\\)?[kKMGTPEZY]?\\)" 1 diredp-inode+size) ; File inode number & size ;; Directory names (list "^..\\([0-9]* \\)*d" (list dired-move-to-filename-regexp nil nil) (list "\\(.+\\)" nil nil '(0 diredp-dir-priv t t))) '("^..\\([0-9]* \\)*.........\\(x\\)" 2 diredp-exec-priv) ;o x '("^..\\([0-9]* \\)*.........\\([lsStT]\\)" 2 diredp-other-priv) ; o misc '("^..\\([0-9]* \\)*........\\(w\\)" 2 diredp-write-priv) ; o w '("^..\\([0-9]* \\)*.......\\(r\\)" 2 diredp-read-priv) ; o r '("^..\\([0-9]* \\)*......\\(x\\)" 2 diredp-exec-priv) ; g x '("^..\\([0-9]* \\)*....[^0-9].\\([lsStT]\\)" 2 diredp-other-priv) ; g misc '("^..\\([0-9]* \\)*.....\\(w\\)" 2 diredp-write-priv) ; g w '("^..\\([0-9]* \\)*....\\(r\\)" 2 diredp-read-priv) ; g r '("^..\\([0-9]* \\)*...\\(x\\)" 2 diredp-exec-priv) ; u x '("^..\\([0-9]* \\)*...\\([lsStT]\\)" 2 diredp-other-priv) ; u misc '("^..\\([0-9]* \\)*..\\(w\\)" 2 diredp-write-priv) ; u w '("^..\\([0-9]* \\)*.\\(r\\)" 2 diredp-read-priv) ; u r '("^..\\([0-9]* \\)*.\\([-rwxlsStT]+\\)" 2 diredp-no-priv keep) ;- '("^..\\([0-9]* \\)*\\([bcsmpS]\\)[-rwxlsStT]" 2 diredp-rare-priv) ; (rare) '("^..\\([0-9]* \\)*\\(l\\)[-rwxlsStT]" 2 diredp-link-priv) ; l (list (concat "^\\([^\n " (char-to-string dired-del-marker) "].*$\\)") 1 diredp-flag-mark-line t) ; Flag/mark lines (list (concat "^\\([" (char-to-string dired-del-marker) "]\\)") ; Deletion flags (D) '(1 diredp-deletion t) '(".+" (dired-move-to-filename) nil (0 diredp-deletion-file-name t))) (list (concat "^\\([^\n " (char-to-string dired-del-marker) "]\\)") ; Flags, marks (except D) 1 diredp-flag-mark t) ))
Without any change, these codes are just two setq calls from yours.
– Kiwon Um
OK, so you’ve confirmed that the new regexp is the problem. The code you just wrote is simply the 23.1 regexp and the current Dired+ font-lock keywords (so no need to eval that second sexp).
But we need to make Dired+ work with the new regexp, which I wrote above. To do that, we’ll need to modify the Dired+ font-lock keywords.
Can you try using the new regexp (IOW, don’t eval any code to redefine the regexp) while modifying the font-lock keywords as I suggested? We might get lucky.
The new regexp basically just adds another level of grouping, so at least some (maybe all) of the indexes in the font-lock keywords will need to be incremented by one. No need to increment the 0 indexes, probably, but some of the others. Start with the one for
‘diredp-date-time’, as I suggested: change it from 1 to 2. That might be all that’s needed. – DrewAdams
Alright. I just modified:
(list dired-move-to-filename-regexp '(1 diredp-date-time t t) ; Date/time
(list dired-move-to-filename-regexp '(2 diredp-date-time t t) ; Date/time.
It really works well without any change of the directory-listing-before-filename-regexp value. Thx. :) Are you going to check-in this to the
dired+.el? Or, after the official release for the emacs24? – Kiwon Um
Thanks for testing. Dunno. If you’re pretty sure it works OK and doesn’t have any negative effects, then I might as well update it now.
The problem will be how to test for the Emacs version. Your dev version has major-version 24, but then next Emacs release will be 23.2, not 24. It’s not clear to me what the right test in the code would be. – DrewAdams
OK, I just uploaded a new version, which should work with the next release (Emacs 23.2). Please test it with your development version, after changing this:
(if (and (fboundp 'version<=) (version<= emacs-version "23.2")) (list 2 'diredp-date-time t t) (list 1 'diredp-date-time t t)) ; Date/time
(if t (list 2 'diredp-date-time t t) (list 1 'diredp-date-time t t)) ; Date/time
Thx – DrewAdams
Fine. It works well. Thx. :) – KiwonUm?
Oops. I had the version test backward. Using
‘t’ for you should have worked, but downloading what I had uploaded should not have worked. I just fixed it. Please download the latest and try it (without changing anything). Sorry about that. – DrewAdams
No problem. I was little weird about that. ;) The new version works for me without any change. Thx. :)
Actually, I made another change to it. The new version should still work for you. – DrewAdams
It works fine as well. Thx. :)
Hello. I have found a bug: when subdirectory is inserted in dired buffer (using command
‘dired-maybe-insert-subdir’), marking the last file before included subdir also marks first file in that subdir. It’s face stays normal, but when performing actions on marked items, it affects that file. Behavior is normal when using dired without the dired+. Here is screenshot illustrating the bug: one file is marked and one more file is affected by the action, performing on marked items. – Anonymous
Thanks very much for this bug report. Should be fixed now. Let me know if you see other problems, particularly in this area. The problem was related to the enhancement of handling multiple
‘C-u’s. – DrewAdams
Works fine now, thanks for fast fixing. – Anonymous
Is there any way to disable the dired+ color customizations and just fall back to the colorscheme installed instead? Or do I have to override each individual setting? I use the zenburn colorscheme and the colors specified in dired+ look unreadable with it. Thanks. – Christoph
Yes, you can customize each Dired+ face separately – they are separate faces. They are Dired+ faces, and like most faces throughout Emacs, they have nothing to do with ColorTheme.
Is ColorTheme what you meant by “the colorscheme installed” and “zenburn colorscheme”? If not, what did you mean? Did you mean the colors you see for Dired in vanilla Emacs, where there are no such faces?
Vanilla Emacs (Dired) does not have such faces, and ColorTheme does not have faces in general. So the answer is yes, in any case: these are separate faces, so if you want to change them all then you need to customize them all (once). – DrewAdams
Yes, I have colortheme installed with the zenburn colorscheme. I installed dired+ but I don’t like the new colors in the dired buffer. They don’t work with Zenburn. So I was wondering if I could keep the general functionality of dired+ but simply disable the “fancy highlighting” or if have to customize each face separately. I think you answered my question though. Thanks! – Christoph
Please download the latest version. I just updated it to fix a problem that has probably been there since Day 1. I thought I had provided properly for users to customize
‘font-lock-maximum-decoration’ to skip the second level of Dired fontification, but I had not. That should now be corrrected.
You can customize option
‘font-lock-maximum-decoration’ to set the level of fontification you want. And you can do this for particular modes if you like. To turn off max highlighting only for Dired mode, do
‘M-x customize-option font-lock-maximum-decoration’ and insert an entry for
‘dired-mode’ that specifies
‘default’ highlighting for it. (You can set another, catch-all entry for
‘all’ that controls all other modes.)
Thanks for bringing this to my attention. Most users want more Dired highlighting, not less, so I never realized this didn’t work properly. Thx – DrewAdams
Perfect! This was exactly what I was looking for. Thanks Drew! – Christoph
Something is broken in 2010/09/29 version of dired+.el. When I call
‘dired-up-directory’ function — instead of visiting parent dir, emacs starts eating all CPU and freezes, until gets killed or interrupted by
‘C-g’. No errors are displayed in the minibuffer or
‘*Messages*’ buffer. 2010/09/27 works fine. – Anonymous
Thanks. Please try the latest. Let me know if you encounter a problem. – DrewAdams
Latest version works good, thanks. – Anonymous
I noticed one annoying regression in recent version of dired+: when function
‘dired-do-flagged-delete’ called it takes few seconds for it to show deletion prompt (or show message than no files selected for deletion). Used to work without noticeable delay few weeks ago. – Anonymous
Yes, I added a call
(sit-for 2) after this message, so you will see the message:
NOTE: Deletion of files flagged `D' (not those marked `*')
That waits 2 seconds, but if you type a key then the timeout is interrupted (no wait). I’m not sure what the right thing to do is. If I remove the
‘sit-for’ then you will never see the message. Maybe the message is not so important. What do you think? – DrewAdams
I think that message is not really important, users who read dired manual alredy know that, ones who didn’t — probably won’t use that command :) Also i consider prompt delay confusing, even if keys work immediately (but you have to wait anyway to see the
*Deletions* buffer with list of files to delete). – Anonymous
OK, I removed the
‘sit-for’. Thanks for the feedback. – DrewAdams
Here is a fresh bug: you added a “p” to dired-toggle-find-file-reuse-dir. From the changelog: “toggle-dired-find-file-reuse-dir: Swapped which one is the alias.” – PasJa
(defalias 'toggle-dired-find-file-reuse-dir 'diredp-toggle-find-file-reuse-dir) ; <--- Here is the bug! ;;;###autoload (defun dired-toggle-find-file-reuse-dir (force-p) ; Not bound "Toggle whether Dired `find-file' commands reuse directories. A prefix arg specifies directly whether or not to reuse. If its numeric value is non-negative then reuse; else do not reuse.
To set the behavior as a preference (default behavior), put this in your ~/.emacs, where VALUE is 1 to reuse or -1 to not reuse:
Thanks. Should be OK now. – DrewAdams
‘diredp-do-grep’ interactively on marked files, the filenames are not quoted in the grep command line. This means that if there are spaces in any of the file names they will not be read correctly. – JoeBloggs
Should be OK now. Thx – DrewAdams
Hello, I’m using emacs from bzr, and some recent changes in trunk broke dired+ fancy highlighting. Rest of functionality seems to work fine. – Anonymous
Anyway, I fixed this in the latest dired+.el on 2011-10-31, so it should be OK now. Unfortunately, because of their change font-locking is now done twice: once with the default highlighting, once with the correct (Dired+) highlighting. You don’t see this as a user, but it does theoretically slow things down a bit. If they fix the bug then I’ll be able to remove the call to refresh font-locking. Be aware too that this will also affect other libraries that set font-lock highlighting. – DrewAdams
Hi, I also had issues using dired+ with zenburn. Instead of shutting off the extra highlighting I set up some (very rough) face customizations that I edited:
(custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(diredp-date-time ((((type tty)) :foreground "yellow") (t :foreground "#F0DFAF"))) '(diredp-dir-heading ((((type tty)) :background "yellow" :foreground "blue") (t :background "#41363C" :foreground "#ECBCBC"))) '(diredp-dir-priv ((t (:background "#3F3F3F" :foreground "thistle")))) '(diredp-display-msg ((((type tty)) :foreground "blue") (t :foreground "#93B3A3"))) '(diredp-file-name ((t (:foreground "#8CD0D3")))) '(diredp-file-suffix ((t (:foreground "#7F9F7F")))) '(diredp-flag-mark-line ((t (:background "#9FAFAF")))) '(diredp-ignored-file-name ((t (:foreground "#80D4AA")))) '(diredp-number ((t (:foreground "#8F8F8F")))) '(diredp-symlink ((t (:foreground "#F0DFAF")))) '(slime-repl-inputed-output-face ((t :background "#41363C" :foreground "#ECBCBC"))))
You do not say anything about what the issues are that you ran into, or how your customization takes care of them. So I have no idea what the problem is, so I cannot try to fix it. Please elaborate. Thx – DrewAdams
Recent chages in bzr seem to have broken font-locking in dired+. It does work after
‘font-lock-mode’ called manually for every buffer, but not by itself. – Anonymous
Can’t do much with that report, I’m afraid. You don’t say what Emacs build date you are using, for one thing. And a recipe from
emacs -Q would help.
emacs -Q with an Emacs 24 trunk build from 2013-02-15 on MS Windows, then loading Dired+ and visiting a directory, I see no problem with the highlighting. More info, please. – DrewAdams
These steps do reproduce bug for me, except I use 2013-02-17 build of GNU Emacs 18.104.22.168 on Linux. – Anonymous
OK, I’ll have to take a look when I get a newer build. But my guess is that the change was in the font-lock code somewhere, and not in the dired code. See above on this page, for changes in the recent past that also broke font-locking for Dired+. If you have time to investigate a bit, that would be great. – DrewAdams
This is certainly a font-lock change, since I noticed strange behavior of it in some other situations. Unfortunately, I’m not familiar enough with emacs inner workings to know even where to start investigating this thing. – Anonymous
I will take a look when I can. Thx for the report. – DrewAdams
So far, this appears to be an Emacs regression. I filed bug #13751 and it was promptly merged to bug #13730. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13751 See also: http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00411.html
Regression appears to be fixed now (26.02.2013) – Anonymous
Yes, I just noticed the same thing. Unfortunately, there are at least two other font-lock bugs that were introduced at the same time, and they are still not fixed. But this problem, affecting Dired+, can be closed. – DrewAdams
Might it be possible to rewrite the redefinitions to something similar to this:
(defvar diredp-auto-initialise t) (defun diredp-do-delete (...) ...) (when diredp-auto-initialise (defalias 'dired-do-delete diredp-do-delete))
This way it would be easier to use some re-definitions, but not others, and backward-compatibility would be maintained. – sabof
Not sure I follow you. How would that make it easier for you to choose which redefinitions you get? Please elaborate. Thx – DrewAdams
One would load it like this:
(defvar diredp-auto-initialise nil) (require 'dired+) ;;; Then I will manually specify what I want redefined. (defalias 'dired-find-file 'diredp-find-file) (defalias 'dired-get-filename 'diredp-get-filename) (defalias 'dired-goto-file 'diredp-goto-file) (defalias 'dired-insert-directory 'diredp-insert-directory) (defalias 'dired-insert-set-properties 'diredp-insert-set-properties) (defalias 'dired-mark-files-regexp 'diredp-mark-files-regexp) (defalias 'dired-mark-pop-up 'diredp-mark-pop-up) (defalias 'dired-pop-to-buffer 'diredp-pop-to-buffer) (defalias 'dired-revert 'diredp-revert) (defalias 'dired-switches-escape-p 'diredp-switches-escape-p) (defalias 'dired-up-directory 'diredp-up-directory)
Otherwise I have to load dired+ like this (which is fine, as far as I’m concerned, but a less obvious solution than the above one):
(cl-defmacro es-preserve-functions ((&rest funcs) &rest body) (let (( list-sym (gensym)) ( list (mapcar (lambda (func) `(,func . ,(symbol-function func))) funcs))) `(let (( ,list-sym (quote ,list)) ( result (progn ,@body))) (mapcar (lambda (func) (fset (car func) (cdr func))) ,list-sym)))) (es-preserve-functions (dired-do-delete dired-do-flagged-delete dired-find-buffer-nocreate) (require 'dired+))
Your macro is the only part that I understand. ;-) (Without it) how will you “manually specify what [you] want redefined”?
I don’t really understand the use case either. If someone really needs to pick apart the Dired+ code they can always do that to get some other behavior. But I don’t see anyone else doing that. Just why do you want the original definitions of a few functions?
Trying to understand the why & how of what you’re asking. Thx – DrewAdams
I’ve edited the comment above to make it more clear.
They probably conflicted with something - I no longer remember exactly what. And I think it’s “normal” for someone to only want to use a part of the package. The advantage of this approach over simply editing the file, is that it’s easier to upgrade. – sabof
Thanks for the clarification. I understand better now. If I were to do something like that it would probably be in the opposite direction, however, as in your macro: let users opt out (not in) for individual function redefinitions.
But I do not plan to do that, unless some good reasons change my mind. Dired+ redefines 2 (very important) Dired macros, 2 Dired menus, and 23 Dired functions. And some such redefinitions work together; they are not independent.
FWIW, I have never had a request similar to yours. So far, I really do not see an important use case for it, sorry. Anyone interested in such fine-grained tweaking is already at an EmacsLisp level that s?he can redefine functions as s?he likes.
The real question wrt use cases is why — what is the need? If you were to communicate your real need/problem, as opposed to just a solution (implementation change), I would be more interested.
IOW, what would you like to see changed wrt particular function redefinitions — specifically? Just what does not work as you expect/like? I would prefer to start by confirming that something specific does not work and then try to fix it.
I do appreciate your feedback and your suggestion, which is clear. So far, I’m not convinced of the need, for Dired+; that’s all. And you have found a solution/workaround for your own use, even if you do not recall what the problems are that it works around.
‘dired-do-deletions’, for example. AFAIK, the changes I make to it are trivial: (1) add a helpful message and (2) accommodate a signature change to
‘dired-internal-do-deletions’ for Emacs 23+.
Just why is that redefinition of
‘dired-do-deletions’ problematic for you? If I have a better understanding of this and other specific problems you see, that will help. – DrewAdams
I just think it’s nice to be able to load a package as a library, and use only the functionality one needs.
I don’t care much about the implementation, as long as it’s easy to do – maybe you could include a similar macro to the one I’ve used, and add some relevant documentation.
At the moment I don’t have any (objective) improvements to particular functions in mind. – sabof
While I agree with you in the abstract, there are zillions of pieces that one could offer as being optional. In Icicles], for example, there are 200 user options and the non-Icicles libraries it loads are all optional. There are many ways to customize the default behavior.
But the same thing goes there: Unless someone points to a particular reason why some Dired+ or Icicles function redefinition should be optional I am disinclined to make it so.
If can point to a problem you run into because of a particular redefinition, I’ll be glad to take a closer look. Thx – DrewAdams