Commit 8eb5d46d authored by David Byers's avatar David Byers
Browse files

Fixed bugs:

430 (documentation kom-friends)
432 (documentation kom-friends)
433 (documentation kom-friends)
455 (subtract comment does not handle prefix arguments corrently)
450 (SnoppKOM and sno.pp.se collide)

Semi-fixed bugs:
449 (completion in subtract comment)
parent dea41be0
2002-04-10 David Byers <david.byers@swipnet.se>
* vars.el.in (kom-server-aliases): Changed sno.pp.se to
kom.sno.pp.se.
* commands1.el (kom-add-footnote): Read prefix arg here and not in
lyskom-add-sub-footnote.
(kom-sub-footnote): Same here.
(lyskom-add-sub-footnote): Don't read prefix arg here. Removed
prompt argument.
(lyskom-add-sub-footnote): Do completion on footnote number.
(lyskom-add-sub-comment): Do completion on comment number.
(lyskom-add-sub-footnote): Use current text as default text to
add/remove only if applicable. If there is only one completion,
use that. If the current text is in the completions, use it. If we
are adding, use the current text unless it is the one we are
adding/removing to/from.
(lyskom-add-sub-comment): Dito.
2002-04-09 David Byers <david.byers@swipnet.se>
* commands1.el (lyskom-add-sub-footnote): Show text number we are
removing from or adding to in the prompt (important when using
prefix args to this command).
(lyskom-add-sub-comment): Show text number we are removing from or
adding to in the prompt (important when using prefix args to this
command).
(kom-add-comment): Read prefix arg here and not in
lyskom-add-sub-comment.
(kom-sub-comment): Same here.
(lyskom-add-sub-comment): Don't read prefix arg here. Removed
prompt argument.
* lyskom-rest.el (lyskom-read-number): Added completions parameter
to this function.
2002-04-08 Ulrik Haugen <qha@lysator.liu.se>
* lyskom-rest.el: When running GNU Emacs let Emacs look up the
......
......@@ -3881,91 +3881,109 @@ must have printed something without a newline at the end of the buffer."
(def-kom-command kom-add-comment (text-no-arg)
"Add a text as a comment to another text."
(interactive "P")
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-add-comment-to)))
(lyskom-add-sub-comment text-no-arg
(lyskom-get-string 'text-to-add-comment-to)
t))
(def-kom-command kom-sub-comment (text-no-arg)
"Remove a comment from a text."
(interactive "P")
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-delete-comment-from)))
(lyskom-add-sub-comment text-no-arg
(lyskom-get-string 'text-to-delete-comment-from)
nil))
(defun lyskom-add-sub-comment (text-no-arg prompt do-add)
(defun lyskom-add-sub-comment (text-no do-add)
"Get the number of the text that is going to have a comment added to it or
subtracted from it
Arguments: TEXT-NO-ARG: an argument as it is gotten from (interactive P)
PROMPT: A string that is used when prompting for a number.
DO-ADD: NIL if a comment should be subtracted.
Otherwise a comment is added"
(let ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text))))
(if text-no
(let* ((comment-text-no (lyskom-read-number
(lyskom-get-string
(if do-add 'text-to-add-q 'text-to-remove-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-comment-to 'sub-comment-to)
comment-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat comment-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-comment 'sub-comment)
comment-text-no
text-no)))
(lyskom-format-insert (if do-add
'confusion-what-to-add-comment-to
'confusion-what-to-sub-comment-from)))))
(if text-no
(let* ((completions (unless do-add
(let ((text-stat (blocking-do 'get-text-stat text-no)))
(when text-stat
(mapcar 'misc-info->comm-in
(lyskom-misc-infos-from-list 'COMM-IN (text-stat->misc-info-list text-stat)))))))
(comment-text-no (lyskom-read-number
(lyskom-format (if do-add 'text-to-add-q 'text-to-remove-q) text-no)
(cond (do-add
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))
((eq (length completions) 1)
(car completions))
((memq lyskom-current-text completions)
lyskom-current-text)
(t nil))
nil
nil
completions
)))
(lyskom-format-insert (if do-add 'add-comment-to 'sub-comment-to)
comment-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat comment-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-comment 'sub-comment)
comment-text-no
text-no)))
(lyskom-format-insert (if do-add
'confusion-what-to-add-comment-to
'confusion-what-to-sub-comment-from))))
(def-kom-command kom-add-footnote (text-no-arg)
"Add a text as a footnote to another text."
(interactive "P")
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-add-footnote-to)))
(lyskom-add-sub-footnote text-no-arg
(lyskom-get-string 'text-to-add-footnote-to)
t))
(def-kom-command kom-sub-footnote (text-no-arg)
"Remove a footnote from a text."
(interactive "P")
(interactive (list (lyskom-read-text-no-prefix-arg 'text-to-delete-footnote-from)))
(lyskom-add-sub-footnote text-no-arg
(lyskom-get-string 'text-to-delete-footnote-from)
nil))
(defun lyskom-add-sub-footnote (text-no-arg prompt do-add)
(defun lyskom-add-sub-footnote (text-no do-add)
"Get the number of the text that is going to have a footnote added to it or
subtracted from it
Arguments: TEXT-NO-ARG: an argument as it is gotten from (interactive P)
PROMPT: A string that is used when prompting for a number.
DO-ADD: NIL if a footnote should be subtracted.
Otherwise a footnote is added"
(let ((text-no (let ((current-prefix-arg text-no-arg))
(lyskom-read-text-no-prefix-arg prompt nil lyskom-current-text))))
(if text-no
(let* ((footnote-text-no (lyskom-read-number
(lyskom-get-string
(if do-add
'text-to-add-footn-q
'text-to-remove-footn-q))
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))))
(lyskom-format-insert (if do-add 'add-footnote-to 'sub-footnote-to)
footnote-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat footnote-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-footnote 'sub-footnote)
footnote-text-no
text-no)))
(lyskom-insert (if do-add
'confusion-what-to-add-footnote-to
'confusion-what-to-sub-footnote-from)))))
(if text-no
(let* ((completions (unless do-add
(let ((text-stat (blocking-do 'get-text-stat text-no)))
(when text-stat
(mapcar 'misc-info->footn-in
(lyskom-misc-infos-from-list 'FOOTN-IN (text-stat->misc-info-list text-stat)))))))
(footnote-text-no (lyskom-read-number
(lyskom-format
(if do-add 'text-to-add-footn-q 'text-to-remove-footn-q)
text-no)
(cond (do-add
(if (eq text-no lyskom-current-text)
nil
lyskom-current-text))
((eq (length completions) 1)
(car completions))
((memq lyskom-current-text completions)
lyskom-current-text)
(t nil))
nil
nil
completions
)))
(lyskom-format-insert (if do-add 'add-footnote-to 'sub-footnote-to)
footnote-text-no
text-no)
(cache-del-text-stat text-no)
(cache-del-text-stat footnote-text-no)
(lyskom-report-command-answer
(blocking-do (if do-add 'add-footnote 'sub-footnote)
footnote-text-no
text-no)))
(lyskom-insert (if do-add
'confusion-what-to-add-footnote-to
'confusion-what-to-sub-footnote-from))))
;;; ================================================================
;;; Addera referens - Add cross reference
......
......@@ -146,6 +146,9 @@ local-hook A hook variable that is made local in LysKOM buffers."
(widget-spec nil)
(doc-string nil)
(minibuffer nil)
(local-hook-doc nil)
(local-var-doc nil)
(server-doc nil)
(arglist args))
(while arglist
(cond ((stringp (car arglist)) (setq doc-string (car arglist)))
......@@ -157,6 +160,7 @@ local-hook A hook variable that is made local in LysKOM buffers."
lyskom-custom-variables))))))
((symbolp (car arglist))
(cond ((eq (car arglist) 'server)
(setq local-var-doc t server-doc t)
(setq elisp-block
(` ((if (and (not (memq (quote (, name))
lyskom-global-boolean-variables))
......@@ -168,6 +172,7 @@ local-hook A hook variable that is made local in LysKOM buffers."
(quote (, name)))))))
((eq (car arglist) 'server-hook)
(setq local-hook-doc t server-doc t)
(setq elisp-block
(` ((add-to-list 'lyskom-elisp-variables
(quote (, name)))
......@@ -175,6 +180,7 @@ local-hook A hook variable that is made local in LysKOM buffers."
(quote (, name)))))))
((eq (car arglist) 'protected)
(setq local-var-doc t)
(setq protected
(` ((put (quote (, name)) 'permanent-local t)
(add-to-list 'lyskom-protected-variables
......@@ -183,6 +189,7 @@ local-hook A hook variable that is made local in LysKOM buffers."
(quote (, name)))))))
((eq (car arglist) 'inherited)
(setq local-var-doc t)
(setq inherited
(` ((add-to-list 'lyskom-inherited-variables
(quote (, name)))
......@@ -193,11 +200,13 @@ local-hook A hook variable that is made local in LysKOM buffers."
(quote (, name)))))))
((eq (car arglist) 'local)
(setq local-var-doc t)
(setq buffer-local
(` ((add-to-list 'lyskom-local-variables
(quote (, name)))))))
((eq (car arglist) 'local-hook)
(setq local-hook-doc t)
(setq buffer-local
(` ((add-to-list 'lyskom-local-hooks
(quote (, name)))))))
......@@ -213,6 +222,25 @@ local-hook A hook variable that is made local in LysKOM buffers."
(car arglist))))
(setq arglist (cdr arglist)))
(when doc-string
(when (or local-var-doc local-hook-doc)
(setq doc-string (concat doc-string "\n")))
(when local-var-doc
(setq doc-string (concat doc-string "\nThis variable is buffer-local.")))
(when local-hook-doc
(setq doc-string (concat doc-string "\nThis variable is a buffer-local hook.")))
(setq doc-string (concat doc-string "\n\n\
Setting this variable in .emacs may not yield the results you expect
since that will affect all LysKOM sessions.")))
(when (and doc-string server-doc)
(setq doc-string (concat doc-string "
This variable is normally stored on a per-session basis in the
LysKOM server, but can be set in your .emacs simply by setting
it using setq or defvar.")))
(` (progn (dont-compile (if (and (boundp (quote (, name)))
(or (not (boundp lyskom-is-loaded))
(not lyskom-is-loaded))
......
......@@ -508,10 +508,10 @@ Read all about it at http://www.lysator.liu.se/history/")
(error-not-recipient . "%#2M is not a recipient of text %#1n.\n")
(moving-name . "Moving text %#3n from %#1M to %#2M...")
(text-to-add-q . "Add which text as a comment? ")
(text-to-remove-q . "Remove which text as a comment? ")
(text-to-add-footn-q . "Add which text as a footnote? ")
(text-to-remove-footn-q . "Remove which text as a footnote? ")
(text-to-add-q . "Add which text as a comment to %#1n? ")
(text-to-remove-q . "Remove which text as a comment from %#1n? ")
(text-to-add-footn-q . "Add which text as a footnote to %#1n? ")
(text-to-remove-footn-q . "Remove which text as a footnote from %#1n? ")
(add-comment-to . "Adding text %#1n as a comment to text %#2n...")
(sub-comment-to . "Removing text %#1n as a comment to text %#2n...")
(add-footnote-to . "Adding text %#1n as a footnote to text %#2n...")
......@@ -3064,7 +3064,8 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-friends-doc . "\
The users named in this list will be displayed using a special face in
the LysKOM buffer.")
the LysKOM buffer. These users are also listed with the command Which
friends (and may be used in other similar commands).")
(kom-morons-doc . "\
The users named in this list will be displayed using a warning face in
......
......@@ -3036,31 +3036,41 @@ If NILDEFAULT is non-nil, return nil if the user enters an empty string"
number))
(defun lyskom-read-number (&optional prompt default history nildefault)
(defun lyskom-read-number (&optional prompt default history nildefault completions)
"Read a number from the minibuffer. Optional arguments: PROMPT DEFAULT
If DEFAULT is non-nil, it is written within parenthesis after the prompt.
DEFAULT could also be of the type which (interactive P) generates.
If NILDEFAULT is non-null then typing return will cause the function
to return nil."
(let ((numdefault (cond ((null default) nil)
((integerp default) default)
((listp default) (car default))
(t nil)))
(number nil)
(numstr nil)
(done nil))
(while (not done)
(setq numstr
(prog1
(lyskom-read-string
(concat (cond ((null prompt) (lyskom-get-string 'give-a-number))
(let* ((numdefault (cond ((null default) nil)
((integerp default) default)
((listp default) (car default))
(t nil)))
(prompt (concat (cond ((null prompt) (lyskom-get-string 'give-a-number))
((symbolp prompt) (lyskom-get-string prompt))
(t prompt))
(if numdefault
(format " (%d) " numdefault)
" "))
nil
history)))
" ")))
(number nil)
(numstr nil)
(done nil))
(while (not done)
(setq numstr
(prog1
(if completions
(lyskom-completing-read prompt
(mapcar (lambda (x) (list (number-to-string x) x))
completions)
nil
nil
nil
history
(when default (number-to-string default)))
(lyskom-read-string
prompt
nil
history))))
(cond ((and (string= numstr "") numdefault)
(setq number numdefault done t))
((and (string= numstr "") nildefault)
......
......@@ -497,10 +497,10 @@ i svensk datorhistoria. L
(error-not-recipient . "%#2M r inte mottagare till inlgg %#1n.\n")
(moving-name . "Flyttar text %#3n frn %#1M till %#2M...")
(text-to-add-q . "Vilket inlgg vill du addera som kommentar? ")
(text-to-remove-q . "Vilket inlgg vill du subtrahera som kommentar? ")
(text-to-add-footn-q . "Vilket inlgg vill du addera som fotnot? ")
(text-to-remove-footn-q . "Vilket inlgg vill du subtrahera som fotnot? ")
(text-to-add-q . "Vilket inlgg vill du addera som kommentar till %#1n? ")
(text-to-remove-q . "Vilket inlgg vill du subtrahera som kommentar frn %#1n? ")
(text-to-add-footn-q . "Vilket inlgg vill du addera som fotnot till %#1n? ")
(text-to-remove-footn-q . "Vilket inlgg vill du subtrahera som fotnot frn %#1n? ")
(add-comment-to . "Adderar text %#1n som kommentar till text %#2n...") ;
(sub-comment-to . "Subtraherar text %#1n som kommentar till text %#2n...")
(add-footnote-to . "Adderar text %#1n som fotnot till text %#2n...") ;
......@@ -3513,7 +3513,8 @@ i servern. Annars sparas det i din .emacs.")
(kom-friends-doc . "\
Namnen p personerna i denna lista kommer att visas med ett speciellt
utseende i LysKOM-bufferten.")
utseende i LysKOM-bufferten. Kommandot Vilka vnner r inloggade (och
andra liknande kommandon) anvnder ocks denna lista.")
(kom-morons-doc . "\
Namnen p personerna i denna lista kommer att visas med ett varnande
......
......@@ -709,7 +709,9 @@ to be displayed in the buffer."
(def-kom-var kom-friends nil
"*List of people whose names should be formatted using kom-friends-face."
"*List of people whose names should be formatted using kom-friends-face.
Also used in kom-who-is-on-and-friend. This is a list of integers (person
numbers)."
server)
(def-kom-var kom-morons nil
......@@ -1009,7 +1011,7 @@ Do not use this variable for proxy authentication.")
("kom.cd.chalmers.se" . "CD-KOM")
("community.roxen.com" . "Roxen Community KOM")
("kom.ds.hj.se" . "DSKOM")
("sno.pp.se" . "SnoppKOM"))
("kom.sno.pp.se" . "SnoppKOM"))
"*An alist mapping server names to shorter identification strings")
(def-kom-var kom-ansaphone-on nil
......
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