Commit 473f9f35 authored by Johan Sundström's avatar Johan Sundström
Browse files

Edit-mode now has a ^U^C^Y binding to insert the commented text unquoted.

parent e47cf7d1
2000-05-28 Johan Sundström <jhs@lysator.liu.se>
* edit-text.el (kom-edit-insert-commented): Edit-mode ^C^Y may now
be preceded with ^U to insert the text totally unchanged, that is,
without prefixing its rows with anything at all.
(lyskom-edit-get-commented): Now takes an optional additional
argument list sent to the callback.
(lyskom-edit-insert-commented): Now takes an optional additional
parameter `prefix' that is prepended to each line. Unfortunately I
had to add a kludge to stay compatible with kom-edit-insert-text,
which seems to be doing some black magic. These functions really
ought to be changed to use a lyskom-edit-insert-text function.
2000-05-27 Johan Sundström <jhs@lysator.liu.se> 2000-05-27 Johan Sundström <jhs@lysator.liu.se>
* commands2.el (kom-list-news): Fixed introduced bug. Works * commands2.el (kom-list-news): Fixed introduced bug. Works
......
...@@ -1003,10 +1003,15 @@ Cannot be called from a callback." ...@@ -1003,10 +1003,15 @@ Cannot be called from a callback."
(lyskom-edit-get-commented 'lyskom-edit-show-commented)) (lyskom-edit-get-commented 'lyskom-edit-show-commented))
(defun kom-edit-insert-commented () (defun kom-edit-insert-commented (arg)
"Insert the commented text with '>' first on each line." "Insert the commented text. Unless an empty prefix argument is
(interactive) given, prepend each line with your commenting prefix (or '>')."
(lyskom-edit-get-commented 'lyskom-edit-insert-commented)) (interactive "P")
(lyskom-edit-get-commented
'lyskom-edit-insert-commented
(list (cond ((and arg (listp arg)) "")
(t (or (lyskom-default-value 'kom-cite-string)
62)))))) ; '>'
(defun kom-edit-insert-buglist () (defun kom-edit-insert-buglist ()
...@@ -1045,8 +1050,10 @@ Cannot be called from a callback." ...@@ -1045,8 +1050,10 @@ Cannot be called from a callback."
(sit-for 0))) (sit-for 0)))
(defun lyskom-edit-get-commented (thendo) (defun lyskom-edit-get-commented (thendo &optional arg-list)
"Get the commented text and text stat and then do THENDO with it." "Get the commented text and text stat and then do THENDO with it.
This function is called with an argument list TEXT TEXT-STAT BUFFER
WINDOW plus any optional arguments given in ARG-LIST."
(let ((p (point))) (let ((p (point)))
(save-excursion (save-excursion
(let* ((buffer (current-buffer)) (let* ((buffer (current-buffer))
...@@ -1068,7 +1075,7 @@ Cannot be called from a callback." ...@@ -1068,7 +1075,7 @@ Cannot be called from a callback."
(blocking-do-multiple ((text (get-text no)) (blocking-do-multiple ((text (get-text no))
(text-stat (get-text-stat no))) (text-stat (get-text-stat no)))
(set-buffer buffer) (set-buffer buffer)
(funcall thendo text text-stat buffer window))) (apply thendo text text-stat buffer window arg-list)))
(t (t
(lyskom-message "%s" (lyskom-get-string 'no-such-text-m)))))) (lyskom-message "%s" (lyskom-get-string 'no-such-text-m))))))
(sit-for 0))) (sit-for 0)))
...@@ -1715,11 +1722,14 @@ the with-output-to-temp-buffer command is issued to make them both apear." ...@@ -1715,11 +1722,14 @@ the with-output-to-temp-buffer command is issued to make them both apear."
(lyskom-view-mode))))))) (lyskom-view-mode)))))))
(defun lyskom-edit-insert-commented (text text-stat editing-buffer window) (defun lyskom-edit-insert-commented (text text-stat editing-buffer window &optional prefix)
"Handles the TEXT and TEXT-STAT from the return of the call of the text. "Handles the TEXT and TEXT-STAT from the return of the call of the text.
The text is inserted in the buffer with '>' first on each line." When given a PREFIX string, that is prepended to each inserted line."
(if (and text text-stat) (if (and text text-stat)
(let ((str (text->decoded-text-mass text text-stat))) (let ((str (text->decoded-text-mass text text-stat))
(prefix (or prefix ; FIXME: kludge that should be removed; it's here just
(lyskom-default-value 'kom-cite-string); because I didn't see
62))) ; how to patch kom-edit-insert-text to behave. :-/ /jhs
(set-buffer editing-buffer) (set-buffer editing-buffer)
(and (not (bolp)) (and (not (bolp))
(insert "\n")) (insert "\n"))
...@@ -1731,9 +1741,9 @@ The text is inserted in the buffer with '>' first on each line." ...@@ -1731,9 +1741,9 @@ The text is inserted in the buffer with '>' first on each line."
(insert te) (insert te)
(while (<= pb (point)) (while (<= pb (point))
(beginning-of-line) (beginning-of-line)
(insert (or (lyskom-default-value 'kom-cite-string) 62)) (when prefix
(forward-line -1) (insert prefix))
))) (forward-line -1))))
(lyskom-message "%s" (lyskom-get-string 'no-get-text)))) (lyskom-message "%s" (lyskom-get-string 'no-get-text))))
......
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