Commit 93538d27 authored by David Byers's avatar David Byers
Browse files

Fix bug 503.

Fix keybindings in lyskom-view-mode.
parent ab74f45a
2002-05-29 David Byers <david.byers@swipnet.se>
Fix bug 503:
* commands2.el (kom-apropos): New function.
(lyskom-apropos-insert): New function.
(lyskom-apropos-insert-docstring): New function.
* view-mode.el (lyskom-view-mode-map): Bind = to
kom-menu-button-press, as in other modes.
2002-05-28 David Byers <david.byers@swipnet.se> 2002-05-28 David Byers <david.byers@swipnet.se>
* help-compile.el (lyskom-help-parse-string): Fixed search for end * help-compile.el (lyskom-help-parse-string): Fixed search for end
......
...@@ -103,7 +103,11 @@ ...@@ -103,7 +103,11 @@
tmp))) tmp)))
(defun lcs-check-help () (defun lcs-check-help ()
"Check the help files" "Check the help files."
(lcs-check-help-sections))
(defun lcs-check-help-sections ()
"Check that all sections exist in all languages."
(let* ((help (mapcar (lambda (x) (cons (car x) (let* ((help (mapcar (lambda (x) (cons (car x)
(mapcar 'car (eval (cdr x))))) (mapcar 'car (eval (cdr x)))))
(get 'lyskom-help-data 'lyskom-language-var))) (get 'lyskom-help-data 'lyskom-language-var)))
...@@ -227,8 +231,8 @@ STRING is the string." ...@@ -227,8 +231,8 @@ STRING is the string."
(concat (concat
(match-string 1 string) (match-string 1 string)
(match-string 3 string) (match-string 3 string)
(match-string 5 string) (match-string 6 string)
(match-string 6 string)) (match-string 8 string))
result)))) result))))
result)) result))
......
...@@ -2919,3 +2919,113 @@ v m" ...@@ -2919,3 +2919,113 @@ v m"
(interactive) (interactive)
(lyskom-insert-before-prompt "Kommandot \"Vilka (r inloggade i) mte\" r flyttat till v m\n")) (lyskom-insert-before-prompt "Kommandot \"Vilka (r inloggade i) mte\" r flyttat till v m\n"))
(defun kom-apropos (re do-all)
"List LysKOM-related symbols whose name or documentation matches a regexp.
With prefix argument, also list symbols that are not part of the semi-stable
interface (i.e. symbols whose name starts with \"lyskom\")."
(interactive "sLysKOM-apropos (regexp): \nP")
(message "Searching for %s..." re)
(let ((result nil)
(case-fold-search t))
(mapatoms
(lambda (atom)
(let ((string nil))
(when (and (or (boundp atom) (fboundp atom))
(or (and do-all (string-match "^lyskom-" (symbol-name atom)))
(string-match "^kom-" (symbol-name atom)))
(or (string-match re (symbol-name atom))
(and (fboundp atom)
(string-match re (or (documentation atom) "")))
(and (boundp atom)
(string-match re (or
(documentation-property
atom 'variable-documentation)
"")))))
(setq result (cons atom result))))))
(setq result
(sort result (lambda (a b)
(string-lessp (symbol-name a)
(symbol-name b)))))
(message "Searching for %s...formatting..." re)
(if result
(let ((buffer (get-buffer-create "*LysKOM-Apropos*")))
(save-window-excursion
(let ((inhibit-read-only t))
(set-buffer buffer)
(help-mode)
(lyskom-view-mode)
(erase-buffer)
(insert "\
In this buffer, go to the name of the symbol and type * to
get full documentation.
")
(lyskom-traverse el result
(lyskom-apropos-insert el))
(toggle-read-only 1))
(message "Searching for %s...formatting...done" re)
(display-buffer buffer)
(goto-char (point-min))))
(message "Nothing found that matches \"%s\"" re))))
(defun lyskom-apropos-insert (sym)
(let ((start (point)))
(insert (symbol-name sym))
(add-text-properties start (point)
`(face bold
mouse-face highlight
lyskom-button t
lyskom-button-text ,(symbol-name sym)
lyskom-button-type func
lyskom-buffer ,(current-buffer)
lyskom-button-arg (lyskom-apropos-item ,sym)))
(insert "\n")
(lyskom-apropos-insert-docstring 'func
sym
(when (fboundp sym)
(documentation sym)))
(lyskom-apropos-insert-docstring 'var
sym
(when (boundp sym)
(documentation-property
sym 'variable-documentation)))
(insert "\n")))
(defun lyskom-apropos-insert-docstring (type sym doc)
(when doc
(insert " ")
(let ((start (point)))
(cond ((eq type 'func) (insert "Func: "))
((eq type 'var) (insert "Var: ")))
(when (not (eq start (point)))
(add-text-properties start (point)
`(face italic
mouse-face highlight
lyskom-button t
lyskom-button-text ""
lyskom-button-type func
lyskom-buffer ,(current-buffer)
lyskom-button-arg (lyskom-apropos-item
(,sym ,type)))))
(insert
(lyskom-truncate-string-to-width
(if (string-match "\\(\r\\|\n\\)" doc)
(substring doc 0 (string-match "\\(\r\\|\n\\)" doc))
doc)
(- (window-width) 12)))
(insert "\n"))))
(defun lyskom-apropos-item (args)
(let ((sym (elt args 0))
(type (elt args 1)))
(cond ((eq type 'func) (describe-function sym))
((eq type 'var) (describe-variable sym))
(t (cond ((fboundp sym)
(describe-function sym))
((boundp sym)
(describe-variable sym)))))))
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
(defun lyskom-help-format-cref (data) (defun lyskom-help-format-cref (data)
(let* ((command (intern (lyskom-help-data-get-attr 'id data))) (let* ((command (intern (lyskom-help-data-get-attr 'id data)))
(command-name (lyskom-command-name command)) (command-name (lyskom-get-string command 'lyskom-command))
(keys (delq nil (keys (delq nil
(mapcar (lambda (x) (mapcar (lambda (x)
(if (and (arrayp x) (if (and (arrayp x)
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
nil nil
(setq lyskom-view-mode-map (make-sparse-keymap)) (setq lyskom-view-mode-map (make-sparse-keymap))
(define-key lyskom-view-mode-map "*" 'kom-button-press) (define-key lyskom-view-mode-map "*" 'kom-button-press)
(define-key lyskom-view-mode-map "+" 'kom-menu-button-press) (define-key lyskom-view-mode-map "=" 'kom-menu-button-press)
(define-key lyskom-view-mode-map "\t" 'kom-next-link) (define-key lyskom-view-mode-map "\t" 'kom-next-link)
(define-key lyskom-view-mode-map [(meta tab)] 'kom-previous-link) (define-key lyskom-view-mode-map [(meta tab)] 'kom-previous-link)
(define-key lyskom-view-mode-map (kbd (lyskom-keys 'button2up)) 'kom-button-click) (define-key lyskom-view-mode-map (kbd (lyskom-keys 'button2up)) 'kom-button-click)
......
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