[sawfish] New function 'report-commands'.
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] New function 'report-commands'.
- Date: Tue, 30 Nov 2010 20:15:58 +0000 (UTC)
commit 3f5c8341b15085dc6a856bff2b1da8ac32cdee31
Author: Teika kazura <teika lavabit com>
Date: Sat Nov 27 13:59:14 2010 +0900
New function 'report-commands'.
OPTIONS | 2 +-
lisp/sawfish/wm/commands.jl | 31 +++++++++++++++++++++++++++++++
lisp/sawfish/wm/util/nokogiri.jl | 15 +--------------
man/news.texi | 3 +++
man/sawfish.texi | 16 ++++++++++++++--
5 files changed, 50 insertions(+), 17 deletions(-)
---
diff --git a/OPTIONS b/OPTIONS
index 88a0efa..b4c0dc3 100644
--- a/OPTIONS
+++ b/OPTIONS
@@ -56,7 +56,7 @@
;; "Show variable names of each customization option.")
;; (defvar-setq customize-command-classes '(default)
-;; "In configurator \"binding\" section, also include commands of these
+;; "In configurator \"binding\" section, show commands of these
;; classes. Possible keys are default, advanced, viewport, and deprecated.")
;; focus options
diff --git a/lisp/sawfish/wm/commands.jl b/lisp/sawfish/wm/commands.jl
index d513844..01b318e 100644
--- a/lisp/sawfish/wm/commands.jl
+++ b/lisp/sawfish/wm/commands.jl
@@ -31,6 +31,7 @@
prefix-numeric-argument
commandp
command-documentation
+ report-commands
;; autoloaded from with-output.jl
call-command-with-output-to-screen
@@ -52,6 +53,13 @@
sawfish.wm.windows.subrs
sawfish.wm.util.with-output)
+ (defvar customize-command-classes '(default)
+ "In configurator \"binding\" section, show commands of
+these classes. For possible keys, see `command-classes-all'".)
+
+ (defvar command-classes-all '(default advanced viewport deprecated)
+ "List of all command classes.")
+
(defvar pre-command-hook '()
"Hook called before calling each command.")
@@ -361,6 +369,29 @@ command called NAME (optionally whose arguments have custom-type TYPE)."
(documentation (intern (closure-name value))
nil value)))))))
+ (define (report-commands #!optional type all)
+ "Returns the list of commands. Each element is the symbol of
+a command name, and they're sorted alphabetically.
+
+The optional argument TYPE is for internal use. When it's non-nil,
+(command-name #:type type-param) is returned for commands with
+\"type\", instead of a symbol.
+
+If the optional argument ALL is nil, returns commands only user wants,
+i.e. those specified by `customize-command-class' are included. Else,
+all commands are returned."
+ (let ((classes (if all
+ command-classes-all
+ customize-command-classes)))
+ (mapcar (lambda (sym)
+ (let ((params (command-type sym)))
+ (if (and type params)
+ (list sym #:type params)
+ sym)))
+ (sort (apropos "" (lambda (x)
+ (and (commandp x)
+ (memq (command-class x) classes))))))))
+
;;; some default commands
(define (run-shell-command command)
diff --git a/lisp/sawfish/wm/util/nokogiri.jl b/lisp/sawfish/wm/util/nokogiri.jl
index 3fd11a8..72d5aff 100644
--- a/lisp/sawfish/wm/util/nokogiri.jl
+++ b/lisp/sawfish/wm/util/nokogiri.jl
@@ -39,11 +39,6 @@
(defvar customize-show-symbols nil
"Show variable names of each customization option.")
- (defvar customize-command-classes '(default)
- "In configurator \"binding\" section, also include commands of
-these classes. Possible keys are default, advanced, viewport, and
-deprecated.")
-
;;; interfaces
(define (nokogiri-report-slot symbol)
@@ -106,15 +101,7 @@ deprecated.")
changes))
(define (nokogiri-report-commands)
- (mapcar (lambda (sym)
- (let ((params (command-type sym)))
- (if params
- (list sym #:type params)
- sym)))
- (sort (apropos "" (lambda (x)
- (and (commandp x)
- (memq (command-class x)
- customize-command-classes)))))))
+ (report-commands t))
(define (nokogiri-grab-key) (event-name (read-event)))
diff --git a/man/news.texi b/man/news.texi
index 0b28178..9b6ce5f 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -106,6 +106,9 @@ possible to produce wrong @file{sawfish.pot}.
@item Updated @file{sawfish.pot} and subsequently all @file{*.po}. Banished some bogus items in @file{sawfish.pot}. (Developer's personal extensios had sneaked into.)
@end itemize
+ item New function @code{report-commands} [Teika kazura] *
+It returns the list of all commands. (@pxref{Operations on Commands}).
+
@item Emacs sawfish-mode now indents @code{let-fluids} and let-loop correctly [Teika Kazura]
@item Documentations [Teika kazura]
diff --git a/man/sawfish.texi b/man/sawfish.texi
index 6f0a63a..a8db406 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -5739,8 +5739,7 @@ this returns @code{nil} or @code{root}, the currently focused window.
@node Operations on Commands, Invoking Commands, Interactive Calling Specification, Commands
@section Operations on Commands
-Once a command has been defined, we can extract certain information
-about it.
+We can extract certain information about commands.
@defun commandp @var{symbol}
Returns @code{t} if @var{symbol} is a command name.
@@ -5761,6 +5760,19 @@ Return the specification, type or class (respectively) of the named
command.
@end defun
+ defun report-commands #!optional type all
+Returns the list of commands. Each element is the symbol of a command
+name, and they're sorted alphabetically.
+
+The optional argument @var{type} is for internal use. when it's non-nil,
+ code{(command-name #:type type-param)} is returned for commands with
+``type'', instead of a symbol.
+
+If the optional argument @var{all} is nil, returns commands only user
+wants, i.e. those specified by @code{customize-command-class} are
+included. Else, all commands are returned.
+ end defun
+
@node Invoking Commands, Default Commands, Operations on Commands, Commands
@section Invoking Commands
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]