暗无天日

=============>DarkSun的个人博客

init-file-management-sunrise-commander

1 增加elpa repository

(add-to-list 'package-archives '("SC"   . "http://joseito.republika.pl/sunrise-commander/")) ;sunrise-commander的安装源
(package-initialize t)

2 sunrise-commander

(package-install-new 'sunrise-commander)

3 The Buttons Extension: making Sunrise a bit more like MC

have written a small extension that may be of help to new users who want to get acquainted fast with the most frequent functions found in the Sunrise Commander and their keybindings. Once installed, it displays a panel with mouse clickable buttons that show some of the most useful actions performed by Sunrise and their respective bindings in the bottom window every time the main panels are invoked.

you can execute any of the functions by clicking the appropriate button, but the extension was conceived more as a simple cheat sheet (a very, very limited one, as you can easily learn by pressing the last button, labeled “More…”) than as a real interface to Sunrise and Dired functions. Eventually, if you like this kind of interaction with the program you can add your own commands to the list and let this extension manage the creation and layout of the buttons for you.

(package-install-new 'sunrise-x-buttons)

4 The Mirror Extension: full read/write access to compressed archives

Unfortunately the access to compressed archives offered by AVFS is limited to read-only operations, so I have written an extension to the Sunrise Commander that provides seamless and effective manipulation of compressed archives in a virtual file system. It is called the Sunrise Mirror Extension and you can get a copy of it here:

Lisp:sunrise-x-mirror.el The ELPA repository at http://joseito.republika.pl/sunrise-commander/ http://joseito.republika.pl/sunrise-x-mirror.el.gz

For this extension to work you must have:

FUSE + AVFS support in your Sunrise Commander. If you can navigate (read-only) inside compressed archives you already have this. One of funionfs or unionfs-fuse. Debian lenny (stable distribution) provides packages for both. Programs required for compressing – at least zip and tar. Your AVFS mount point (and the value of variable sr-avfs-root) must be in a directory where you have writing access.

All this means is that most probably this extension will work out-of-the-box on Linux (or MacOS, or other unices), but you’ll have a hard time to make it work on Windows. It was written on GNU Emacs 23 on Linux and tested on GNU Emacs 22 and 23 for Linux.

;; (package-install-new 'sunrise-x-mirror)

5 The Loop Extension: copying and renaming files in the background

Not long ago I read in some discussion board a quite nice comment regarding the Sunrise Commander, something on the lines of “beautiful stuff, but it will never be a real file manager as long as emacs remains single-threaded”. The answer any seasoned emacs user would give in such situation would be something like “you may have as many processes as you need - have you ever heard of openwith?” and, in the case of Sunrise, it is mostly right, but there was one small exception that already had had the chance to bug me a lot since I started using Sunrise as my default FM: copying and renaming files bigger than several hundred megabytes is a painful operation that can freeze your emacs for a looong time and toss you out of your flow without a good reason.

Then somewhere else I read about this emacs user that launches as many instances of emacs as needed, because memory is cheap these days, and who cares. But that didn’t look to me like something I could seriously suggest to an annoyed user.

So I wrote a new extension to the Sunrise Commander that allows to execute asynchronously this kind of tasks. Actually it does launch a separate elisp interpreter (with a limited set of functions loaded) and delegates to it the dirty work, but it also manages automatically the life cycle of this new instance and all the communication between the main and the background ones. In order to perform your copy or rename operation in the background, the only thing you have to do is add an empty prefix to the usual keystroke (e.g. C will perform a regular copy in the foreground and C-u C will do it in the background).

(package-install-new 'sunrise-x-loop)

6 The PopViewer Extension: making the viewer window float

(package-install-new 'sunrise-x-popviewer)

7 The Mode Line Extension: directory paths always in sight

Here is a new usability enhancement I’ve just released for the Sunrise Commander window manager: sunrise‐x‐modeline ‐‐ a minor mode that puts the directory path of each Sunrise pane on the mode line of its respective window, so it remains always visible. This spares the need to scroll up long sunrise buffers just to check where exactly you are in the file system.

Additionally, three small status icons are shown on the left side of the path. These icons are by default plain ASCII characters, but nicer semi-graphical versions can be used instead by customizing the sr-modeline-use-utf8-marks variable.

(package-install-new 'sunrise-x-modeline)

8 The Tabs Extension

his extension brings tab‐based navigation to the Sunrise Commander. It adds to the list of optional mechanisms already available in Sunrise for moving around the file system (like regular bookmarks, checkpoints, history rings, materialized virtual buffers, navigable paths and file‐following) another way to maintain a list of selected locations one wants to return later on, or to compose “breadcrumb trails” for complex repetitive operations.

The main difference between tabs and other mechanisms is that once a buffer has been assigned to a tab, it will not be killed automatically by Sunrise, so it’s possible to keep it around as long as necessary with all its marks and state untouched. Tabs can be persisted across sessions using the DeskTop feature.

(package-install-new 'sunrise-x-tabs)

9 The Tree Extension

This extension adds to Sunrise a tree view of directories that can be used for extremely fast navigation, as well as for several basic operations on files and directories. It uses the excellent “tree-widget.el” library written by David Ponce, does work in the console as well as in graphical environments and offers three different sets of key bindings (mouse centric, arrow keys and alphanumeric keys) to easily adapt to a wide variety of usage patterns.

Navigation inside compressed archives (via AVFS) is supported in tree views (press # to toggle).

(package-install-new 'sunrise-x-tree)

10 The Checkpoint Extension

Beginning with version 4 of the Sunrise Commander, checkpoints were redefined to be a special form of bookmarks. Unfortunately, the differences between the bookmarks frameworks in Emacs 22 and Emacs 23 are so big that including this code directly in the sunrise-commander script would make it incompatible with Emacs 22. For this reason both versions of checkpoints are now provided as dynamically loaded extensions, so that you can decide which of them to use. To be sure, this is the version I intend to further develop, as it has a richer set of functions and integrates more nicely to the rest of Emacs. The other one is deprecated and will eventually disappear once Emacs 23+ becomes the “stable” release.

(package-install-new 'sunrise-x-checkpoints)

11 The Windows Add-ons Extension

Not long ago, a user of the Sunrise Commander FM on MS Windows asked me if there are any facilities in SC that would give him easy access to the different drives and special folders in this OS. Since there weren’t any I wrote the Windows Add-ons Extension.

This extension implements a listing of all Windows drives and special folders inside the Sunrise Commander, as well as support for symbolic links (shortcuts) for all file system operations inside Sunrise.

One caveat, though: this is only for Emacs ports that run directly on the Windows file system (like e.g. EmacsW32) if yours works on top of some simulation layer that maps the file system (such as Cygwin), you don’t need this code.

(package-install-new 'sunrise-x-w32-addons)

12 provide feature

(provide 'init-file-management-sunrise-commander)