Commit 815e080f authored by David Byers's avatar David Byers
Browse files

Added help on individual commands; XEmacs compatibility; updated menus

parent 275280f8
2009-03-08 David Byers <davby@ida.liu.se>
Add access to command descriptions:
* help.el (lyskom-help-on-command): New function.
XEmacs compatibility:
* compatibility.el (detect-coding-string): Compatibility
definition for XEmacs.
Defensive coding for bug 1660:
* edit-text.el (lyskom-create-text-handler): New parameter
......@@ -169,7 +175,7 @@
(lyskom-en-mode-map): Bind "vu" to "View URL".
2007-07-20 Hans Eric Svensson <eric+lyskom@lysator.liu.se>
* view-text.el (lyskom-follow-comments): Adjusted to take into
account that text-read-p doesn't know if a text *should* be read,
it only only knows if a text *is marked* as read.
......@@ -318,7 +324,6 @@
(lyskom-format-insert-at-point): Simplified.
(lyskom-format-insert): Simplified.
>>>>>>> 44.943
2007-06-26 <David Byers@GULAG>
* utilities.el (lyskom-indirect-assq): If assoc-list is t, then
......@@ -608,7 +613,7 @@
(lyskom-string-to-int): Clarifyig comment in docstring.
2007-04-26 Hans Eric Svensson <eric+lyskom@lysator.liu.se>
* lyskom-rest.el (lyskom-cache-all-memberships): New function
which loads memberships into cache, so that we can be really sure
that we haven't read a specific text.
......@@ -748,7 +753,7 @@
to menu.
Fix bug 1510:
* vars.el.in (lyskom-commands): Added kom-review-mode-comments.
* vars.el.in (lyskom-commands): Added kom-review-more-comments.
* swedish-strings.el,english-strings.el
(lyskom-sv-mode-map,lyskom-en-mode-map): Added
......
......@@ -1827,6 +1827,7 @@ not function names."
(lyskom-insert-before-prompt (concat msg "\n"))
(message msg))))
;;;============================================================
;;; Visa user-arean (kom-show-user-area)
;;;
......
......@@ -315,6 +315,12 @@ KEYS should be a string in the format used for saving keyboard macros
(lyskom-original-string-width (lyskom-string-make-multibyte str)))
(t (lyskom-original-string-width str))))))
;; XEmacs doesn't have detect-coding-string
;; Make a version that just plain doesn't do anything
(lyskom-function-alias detect-coding-string (string &optional highest)
(if highest 'undecided '(undecided)))
;;; ================================================================
;;; Faces and windows and stuff
......
......@@ -75,7 +75,7 @@ Value returned is always nil."
(defvar lyskom-help-syntax
'((help (language) nil (section) lyskom-help-parse-process-finish)
(section (id prompt) nil (p list h1 h2 h3 inline refer keymap) lyskom-help-parse-process-section)
(section (id prompt) nil (p list h1 h2 h3 inline refer keymap call) lyskom-help-parse-process-section)
(h1 nil nil (cref TEXT) nil)
(h2 nil nil (cref TEXT) nil)
(h3 nil nil (cref TEXT) nil)
......@@ -85,6 +85,7 @@ Value returned is always nil."
(list nil (header) (item) nil)
(item nil nil (refer b i cref TEXT) nil)
(keymap nil nil nil)
(call (function) nil nil)
(inline (id) nil nil lyskom-help-parse-process-section-ref)
(refer (id) nil nil lyskom-help-parse-process-section-ref)
(cref (id) nil nil lyskom-help-parse-process-command-ref)
......
<!-- -*-mode: xml-*- -->
<help language="en">
<section id="help-on-command" prompt="Command description">
<call function="lyskom-help-on-command" />
</section>
<section id="commands" prompt="Keyboard commands">
<p>Keyboard commands:</p>
<keymap />
......
<!-- -*-mode: xml-*- -->
<help language="sv">
<section id="help-on-command" prompt="Kommandobeskrivning">
<call function="lyskom-help-on-command" />
</section>
<section id="commands" prompt="Snabbkommandon">
<p>Snabbommandon:</p>
<keymap />
......
......@@ -92,6 +92,7 @@
(refer . lyskom-help-format-refer)
(cref . lyskom-help-format-cref)
(section . lyskom-help-format-section)
(call . lyskom-help-call-function)
(TEXT . lyskom-help-format-TEXT))
)
......@@ -165,6 +166,10 @@
(let ((this-command-keys nil))
(lyskom-insert (lyskom-help t))))
(defun lyskom-help-call-function (data)
(let ((fn (lyskom-help-data-get-attr 'function data)))
(funcall (intern fn))))
(defun lyskom-help-format-refer (data)
(let* ((id (intern (lyskom-help-data-get-attr 'id data)))
(section (lyskom-help-get-section id))
......@@ -223,3 +228,37 @@
(lyskom-fill-region (point-min) (point-max))))
(lyskom-insert "\n\n")
(set-marker start nil)))
(defvar lyskom-swedish-bindings-reverse)
(defun lyskom-help-on-command (&rest args)
(let* ((cmd (lyskom-read-extended-command))
(specials (lyskom-menu-guess-shortcuts (current-local-map)))
(shortcut nil))
(when cmd
(if (assq cmd specials)
(unless (lyskom-traverse key (cdr (assq cmd specials))
(unless (condition-case nil
(eq (lookup-key (current-local-map) key) cmd)
(error nil))
(lyskom-traverse-break t)))
(setq shortcut
(mapconcat
(lambda (key)
(if (assq key lyskom-swedish-bindings-reverse)
(symbol-name
(cdr (assq key lyskom-swedish-bindings-reverse)))
(single-key-description key)))
(car (cdr (assq cmd specials)))
" ")))
(setq shortcut (delq nil (mapcar (lambda (kd) (unless (symbolp (elt kd 0)) kd))
(where-is-internal cmd)))))
(lyskom-format-insert "\n%#1C%#2?b%[ [%#2s]%]%[%]\n\n%#3s\n\n"
cmd
(if (stringp shortcut)
shortcut
(mapconcat
(lambda (x)
(format "`%s'" (key-description x)))
shortcut ", "))
(documentation cmd)))))
......@@ -350,7 +350,7 @@ Automatically created with def-komtype" type)
(charset (lyskom-mime-content-type-get content-type 'charset)))
(condition-case nil
(cond (charset (lyskom-mime-decode-string str charset))
((and (setq charset (detect-coding-string str t))
((and (setq charset (lyskom-detect-coding-string str t))
(not (memq charset '(raw-text undecided))))
(lyskom-mime-decode-string str charset))
((setq charset lyskom-server-coding-system)
......
......@@ -125,6 +125,7 @@
(hline)
(item kom-save-text)
(item kom-save-text-body)
(item kom-view-url-in-text)
(hline)
(item kom-compare-texts)
(item kom-diff-texts)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment