unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <bob@rattlesnake.com>, <emacs-devel@gnu.org>
Subject: RE: dired-details: show/hide file details in Dired
Date: Wed, 4 Jul 2007 07:57:40 -0700	[thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACMEDACAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <E1I62Tx-0003KT-CI@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 134 bytes --]

>     http://www.emacswiki.org/cgi-bin/wiki/dired-details%2b.el.
> 
> RMS and many others are not going to go to a Web site

Attached.

[-- Attachment #2: dired-details+.el --]
[-- Type: application/octet-stream, Size: 8720 bytes --]

;;; dired-details+.el --- Enhancements to library `dired-details+.el'.
;; 
;; Filename: dired-details+.el
;; Description: Enhancements to library `dired-details+.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 2005-2007, Drew Adams, all rights reserved.
;; Created: Tue Dec 20 13:33:01 2005
;; Version: 
;; Last-Updated: Fri Jan 19 20:59:48 2007 (-28800 Pacific Standard Time)
;;           By: dradams
;;     Update #: 141
;; URL: http://www.emacswiki.org/cgi-bin/wiki/dired-details+.el
;; Keywords: dired, frames
;; Compatibility: GNU Emacs 20, GNU Emacs 22
;; 
;; Features that might be required by this library:
;;
;;   `autofit-frame', `avoid', `dired-details', `fit-frame',
;;   `frame-cmds', `frame-fns', `misc-fns', `strings', `thingatpt',
;;   `thingatpt+'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Commentary: 
;; 
;;  This enhances the functionality of library `dired-details.el'.
;;
;;  1. It shrink-wraps Dired's frame whenever you show or hide
;;     details.  For this enhancement, you will need library
;;     `autofit-frame.el'.
;;
;;  2. It advises `dired-byte-compile', `dired-compress',
;;     `dired-create-files' and `dired-create-directory', so that
;;     whenever you create new files or directories or rename them the
;;     hide/show overlays are updated accordingly.
;;
;;  3. It adds user option `dired-details-propagate-flag' which, if
;;     non-nil, propagates the last state you chose to the next Dired
;;     buffer you open.
;;
;;  4. It binds both `)' and `(' to `dired-details-toggle'.
;;
;;  Perhaps #2 corresponds to this TO-DO item in `dired-details.el':
;;
;;    * add a hook for dired-add-file to hide new entries as necessary
;;
;;
;;  ***** NOTE: The following function defined in `dired-details.el'
;;              has been REDEFINED HERE:
;;
;;  `dired-details-activate' - If `dired-details-propagate-flag' is
;;                             non-nil, then use the last state.
;;
;;  ***** NOTE: The following functions defined in `dired-aux.el' have
;;              been REDEFINED HERE (advised only):
;;
;;  `dired-byte-compile', `dired-compress', `dired-create-files',
;;  `dired-create-directory' - Update overlays.
;;
;;
;;  I have submitted these enhancements to Rob Giardina, the author of
;;  `dired-details.el', for inclusion in that library.  When they (or
;;  similar) are added to that library, I'll remove this library.
;;
;;  Put this in your initialization file (~/.emacs):
;;
;;   (require 'dired-details+)
;;
;;  I also recommend customizing `dired-details-hidden-string' to use
;;  the value "" instead of the default "[...]" - less wasted space.
;;
;;  Note: This library also calls `dired-details-install', activating
;;  show/hide and binding keys `(' and `)'.
;;    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Change log:
;; 
;; 2006/02/02 dadams
;;     Bind both ) and ( to dired-details-toggle.
;; 2006/01/02 dadams
;;     Advised dired-byte-compile and dired-compress.
;; 2006/01/01 dadams
;;     Advised dired-create-directory.
;; 2005/12/30 dadams
;;     Advised dired-create-files.
;;     dired-details-(show|hide): Only fit frame if it's showing Dired.
;; 2005/12/26 dadams
;;     Updated groups.
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; 
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; ;; Floor, Boston, MA 02110-1301, USA.
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Code:

;;; Do this `defcustom' first, before we load `dired-details', so we
;;; don't pick up the `defcustom' there.  The default value here is
;;; the empty string, so the overlay doesn't give a false impression
;;; of the current column number.  This is important for frame fitting
;;; (see library `fit-frame.el', required by `autofit-frame.el').
(defcustom dired-details-hidden-string ""
  "*This string will be shown in place of file details and symbolic links."
  :group 'dired-details :group 'dired
  :type 'string)

(require 'dired-details nil t) ;; (no error if not found): dired-details-hide,
                               ;; dired-details-install, dired-details-show
(require 'autofit-frame nil t) ;; (no error if not found): fit-frame-if-one-window

;;;;;;;;;;;;;;;;;;;;;;;;;;


(defcustom dired-details-propagate-flag t
  "Non-nil means next Dired buffer should be displayed the same.
The last `dired-details-state' value set is used by the next Dired
buffer created."
  :type 'boolean)

(defvar dired-details-last-state nil
  "Last `dired-details-state' value.
This is changed each time any Dired buffer's state changes.")




;;; REPLACE ORIGINAL in `dired-details.el'.
;;;
;;; Use last hide/show state, if `dired-details-propagate-flag'.
;;; 
(defun dired-details-activate ()
  "Set up dired-details in the current dired buffer.
Called by `dired-after-readin-hook' on initial display and when a
subdirectory is inserted (with `i').  The state is chosen as follows:
If the state is already established here, leave it alone.
If `dired-details-propagate-flag' is non-nil, then use the last state.
Otherwise, use the default state, as determined by
  `dired-details-initially-hide'."
  (cond (dired-details-state            ; State chosen in this buffer; respect it.
         (when (eq 'hidden dired-details-state)
           (dired-details-hide)))
        ((and dired-details-propagate-flag ; Inherit state from previous.
              dired-details-last-state)
         (when (eq 'hidden dired-details-last-state)
           (dired-details-hide)))
        (t
         ;;otherwise, use the default state
         (when dired-details-initially-hide
           (dired-details-hide)))))

;; The test (get-buffer-window (current-buffer)) is to make sure that
;; Dired is already displayed.  If not, the selected frame is not what
;; we want to fit.
(when (fboundp 'dired-details-show)
  (dired-details-install)
  ;; Override bindings in `dired-details-install'.
  (define-key dired-mode-map "(" 'dired-details-toggle)
  (define-key dired-mode-map ")" 'dired-details-toggle)
  (defadvice dired-details-show (after fit-dired-frame activate)
    "Save `dired-details-last-state'.  Fit Dired frame if `one-window-p'."
    (setq dired-details-last-state dired-details-state)
    (when (and (get-buffer-window (current-buffer))
               (fboundp 'fit-frame-if-one-window))
      (fit-frame-if-one-window)))

  (defadvice dired-details-hide (after fit-dired-frame activate)
    "Save `dired-details-last-state'.  Fit Dired frame if `one-window-p'."
    (setq dired-details-last-state dired-details-state)
    (when (and (get-buffer-window (current-buffer))
               (fboundp 'fit-frame-if-one-window))
      (fit-frame-if-one-window))))


;; `dired-create-files' is defined in `dired-aux.el'.
;;;###autoload
(defadvice dired-create-files (after dired-details-activate activate)
  "Set up Dired details."
  (dired-details-delete-overlays)
  (dired-details-activate))

;; `dired-create-directory' is defined in `dired-aux.el'.
;;;###autoload
(defadvice dired-create-directory (after dired-details-activate activate)
  "Set up Dired details."
  (dired-details-delete-overlays)
  (dired-details-activate))

;; `dired-byte-compile' is defined in `dired-aux.el'.
;;;###autoload
(defadvice dired-byte-compile (after dired-details-activate activate)
  "Set up Dired details."
  (dired-details-delete-overlays)
  (dired-details-activate))

;; `dired-compress' is defined in `dired-aux.el'.
;;;###autoload
(defadvice dired-compress (after dired-details-activate activate)
  "Set up Dired details."
  (dired-details-delete-overlays)
  (dired-details-activate))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide 'dired-details+)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; dired-details+.el ends here

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-07-04 14:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 12:55 [doug@bagley.org: Re: mouse-1-click-follows-link in dired surprising] Richard Stallman
2006-07-04 13:18 ` Chong Yidong
2006-07-04 17:40 ` [doug@bagley.org: Re: mouse-1-click-follows-link in diredsurprising] Drew Adams
2006-07-05  2:24   ` Miles Bader
2006-07-05  3:42     ` Dired coloring and other conveniences Drew Adams
2007-07-02  5:42       ` dired-details: show/hide file details in Dired Drew Adams
2007-07-02 13:04         ` Mathias Dahl
2007-07-02 13:46           ` Drew Adams
2007-07-02 20:50             ` Mathias Dahl
2007-07-02 21:04               ` Drew Adams
2007-07-02 14:02           ` add directory selection to the "compile" command lucatrv
2007-07-02 15:55             ` Denis Bueno
2007-07-04 18:38               ` lucatrv
2007-07-02 14:04         ` dired-details: show/hide file details in Dired Rob Giardina
2007-07-02 22:39           ` Richard Stallman
2007-07-02 22:53             ` Drew Adams
2007-07-02 23:01               ` Rob Giardina
2007-07-03  1:17               ` Stefan Monnier
2007-07-03  5:44                 ` Drew Adams
2007-07-05 13:41                   ` Stefan Monnier
2007-07-04  3:43               ` Richard Stallman
2007-07-04  3:53                 ` Rob Giardina
2007-07-05  1:30                   ` Richard Stallman
2007-07-04  5:51                 ` Drew Adams
2007-07-04 10:53                   ` Robert J. Chassell
2007-07-04 14:57                     ` Drew Adams [this message]
2007-07-04 17:10                     ` Robert J. Chassell
2007-07-04 20:00                       ` Drew Adams
2007-07-04 21:57                         ` Robert J. Chassell
2007-07-05  1:31                       ` Richard Stallman
2007-07-05  6:58                         ` Drew Adams
2007-07-05 11:38                           ` Robert J. Chassell
2007-07-05 20:34                             ` Richard Stallman
2007-07-05 20:49                               ` Drew Adams
2007-07-05 21:35                                 ` Robert J. Chassell
2007-07-08 22:24                                 ` Richard Stallman
2007-07-05 20:34                           ` Richard Stallman
2007-07-05  1:30                   ` Richard Stallman
2007-07-05  2:40                     ` Rob Giardina
2007-07-05 20:34                       ` Richard Stallman
2007-07-05  1:30                   ` Richard Stallman
2007-07-05  3:22                     ` Rob Giardina
2007-07-05 20:34                       ` Richard Stallman
2006-07-06 13:32     ` [doug@bagley.org: Re: mouse-1-click-follows-link in diredsurprising] Richard Stallman
2006-07-06 21:41       ` Miles Bader
2006-07-08 20:57         ` Richard Stallman
2006-07-08 21:24           ` Luc Teirlinck
2006-07-09 19:02             ` Richard Stallman
2006-07-08 21:35           ` Luc Teirlinck
2006-07-08 22:15           ` Luc Teirlinck
2006-07-09 19:02             ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BNELLINCGFJLDJIKDGACMEDACAAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=bob@rattlesnake.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).