Skip to content
Browse files

+New function sr-extend-with for explicit registration of extensions.

This function is effectively a no-op when the sr-autoload-extensions
variable is customized to be nil. Used in autoload cookies.
  • Loading branch information...
1 parent 6045496 commit 80bfccf8b98ceaa8e20b32a868c5d0a7a3867d77 @escherdragon committed Dec 11, 2011
View
15 sunrise-commander.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 24 Sep 2007
;; Version: 5
-;; RCS Version: $Rev: 393 $
+;; RCS Version: $Rev: 394 $
;; Keywords: files, dired, midnight commander, norton, orthodox
;; URL: http://www.emacswiki.org/emacs/sunrise-commander.el
;; Compatibility: GNU Emacs 22+
@@ -223,6 +223,12 @@ You can always toggle file attributes display pressing \\<sr-mode-map>\\[sr-togg
:group 'sunrise
:type 'boolean)
+(defcustom sr-autoload-extensions t
+ "Whether to load extensions immediately after their declaration, or when the
+SC core is loaded (e.g. when using autoload cookies)."
+ :group 'sunrise
+ :type 'boolean)
+
(defcustom sr-show-hidden-files nil
"Whether to initially display hidden files in Sunrise panes.
You can always toggle hidden files display pressing \\<sr-mode-map>\\[dired-omit-mode].
@@ -875,6 +881,13 @@ This is done so all its dired-filename attributes are kept in the file."
(enriched-mode 1)))
(add-hook 'before-save-hook 'sr-enrich-buffer)
+(defun sr-extend-with (extension &optional filename)
+ "Try to enhance Sunrise with EXTENSION (argument must be a symbol).
+An extension can be loaded from optional FILENAME. If found, the extension is
+immediately loaded, but only if `sr-autoload-extensions' is not nil."
+ (when sr-autoload-extensions
+ (require extension filename t)))
+
(defadvice dired-find-buffer-nocreate
(before sr-advice-findbuffer (dirname &optional mode))
"A hack to avoid some Dired mode quirks."
View
10 sunrise-x-buttons.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 11 Jun 2008
;; Version: 1
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, shortcut buttons
;; URL: http://www.emacswiki.org/emacs/sunrise-x-buttons.el
;; Compatibility: GNU Emacs 22+
@@ -42,10 +42,8 @@
;; 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.
-;; This is version 1 $Rev: 388 $ of the Sunrise Commander Buttons Extension.
-
-;; It was written on GNU Emacs 23 on Linux, and tested on GNU Emacs 22 and 23
-;; for Linux and on EmacsW32 (version 22) for Windows.
+;; This extension was developed on GNU Emacs 23 on Linux, and tested on
+;; GNU Emacs 22 and 23 for Linux and on EmacsW32 (version 22) for Windows.
;;; Installation and Usage:
@@ -286,6 +284,6 @@ Used inside the Sunrise Buttons buffer."
(provide 'sunrise-x-buttons)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-buttons))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-buttons))
;;; sunrise-x-buttons.el ends here
View
4 sunrise-x-loop.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 27 Jun 2008
;; Version: 3
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, background copy rename move
;; URL: http://www.emacswiki.org/emacs/sunrise-x-loop.el
;; Compatibility: GNU Emacs 22+
@@ -340,6 +340,6 @@ triggered by `sr-do-rename' inside a loop scope."
(provide 'sunrise-x-loop)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-loop))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-loop))
;;; sunrise-x-loop.el ends here
View
4 sunrise-x-mirror.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 4 May 2008
;; Version: 2
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, archives read/write
;; URL: http://www.emacswiki.org/emacs/sunrise-x-mirror.el
;; Compatibility: GNU Emacs 22+
@@ -566,6 +566,6 @@ so they are always writeable by default."
(provide 'sunrise-x-mirror)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-mirror))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-mirror))
;;; sunrise-x-mirror.el ends here
View
9 sunrise-x-modeline.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 10 Oct 2009
;; Version: 2
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, modeline, path mode line
;; URL: http://www.emacswiki.org/emacs/sunrise-x-modeline.el
;; Compatibility: GNU Emacs 22+
@@ -57,9 +57,7 @@
;; The extension is provided as a minor mode, so you can enable / disable it
;; totally by issuing the command `sr-modeline'.
-;; This is version 2 $Rev: 388 $ of the Sunrise Commander Modeline Extension.
-
-;; It was written on GNU Emacs 23 on Linux, and tested on GNU Emacs 22 and 23
+;; It was written on GNU Emacs 24 on Linux, and tested on GNU Emacs 22 and 23
;; for Linux and on EmacsW32 (version 22) for Windows.
;;; Installation and Usage:
@@ -303,7 +301,6 @@ This is a minor mode that provides a single keybinding:
(define-key menu-map [disable] '("Toggle" . sr-modeline-toggle))))
(defun sr-modeline-start-once ()
- ;; FIXME
"Bootstrap the navigation mode line on the first execution of
the Sunrise Commander, after module installation."
(sr-modeline t)
@@ -327,6 +324,6 @@ the Sunrise Commander, after module installation."
(provide 'sunrise-x-modeline)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-modeline))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-modeline))
;;; sunrise-x-modeline.el ends here
View
4 sunrise-x-popviewer.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 20 Aug 2008
;; Version: 2
-;; RCS Version: $Rev: 392 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, windows, accessibility, viewer
;; URL: http://www.emacswiki.org/emacs/sunrise-x-popviewer.el
;; Compatibility: GNU Emacs 22+
@@ -180,6 +180,6 @@ passive pane."
(sr-popviewer-mode (if sr-popviewer-enabled 1 -1))
(provide 'sunrise-x-popviewer)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-popviewer))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-popviewer))
;;; sunrise-x-popviewer.el ends here
View
4 sunrise-x-tabs.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 24 Oct 2009
;; Version: 1
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, tabs
;; URL: http://www.emacswiki.org/emacs/sunrise-x-tabs.el
;; Compatibility: GNU Emacs 22+
@@ -635,6 +635,6 @@ tabs in the Sunrise Commander (used for desktop support)."
(provide 'sunrise-x-tabs)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-tabs))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-tabs))
;;; sunrise-x-tabs.el ends here
View
4 sunrise-x-tree.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 4 May 2010
;; Version: 1
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, directories tree navigation
;; URL: http://www.emacswiki.org/emacs/sunrise-x-tree.el
;; Compatibility: GNU Emacs 22+
@@ -1202,6 +1202,6 @@ switch to normal mode, then execute."
(provide 'sunrise-x-tree)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-tree))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-tree))
;;; sunrise-x-tree.el ends here
View
4 sunrise-x-w32-addons.el
@@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 14 May 2011
;; Version: 1
-;; RCS Version: $Rev: 388 $
+;; RCS Version: $Rev: 394 $
;; Keywords: sunrise commander, w32, ms windows
;; URL: http://www.emacswiki.org/emacs/sunrise-x-w32-addons.el
;; Compatibility: GNU Emacs 23+
@@ -271,6 +271,6 @@ End Function")
(provide 'sunrise-x-w32-addons)
-;;;###autoload (eval-after-load 'sunrise-commander '(require 'sunrise-x-w32-addons))
+;;;###autoload (eval-after-load 'sunrise-commander '(sr-extend-with 'sunrise-x-w32-addons))
;;; sunrise-x-w32-addons.el ends here

0 comments on commit 80bfccf

Please sign in to comment.
Something went wrong with that request. Please try again.