Commit 3c60b2fc authored by Johan Sundström's avatar Johan Sundström
Browse files

Added kom-edit-insert-buglist command [C-c C-b] to edit buffer.

parent 890a066a
2000-04-29 Johan Sundstrm <jhs@lysator.liu.se>
* edit-text.el (kom-edit-insert-buglist): New command in the edit
window for inserting a commented Roxen IS style bug/todo-list.
(lyskom-edit-insert-buglist): Implements the lower-level parts of
the above. Relies on the availability of thing-at-point-looking-at
from lack of better knowledge of elisp. :-}
* swedish-strings.el (lyskom-sv-edit-mode-map): Added binding for
kom-edit-insert-buglist; C-c C-b for now.
(lyskom-menu): Added menu shortcut for kom-edit-insert-buglist.
* utilities.el: (lyskom-read-text-no-prefix-arg): negative prefix
arguments are now interpreted as a reference to the text-no `arg'
messages up in the kom buffer.
......
......@@ -1004,11 +1004,17 @@ Cannot be called from a callback."
(defun kom-edit-insert-commented ()
"Insert the commented text with '>' first on each line"
"Insert the commented text with '>' first on each line."
(interactive)
(lyskom-edit-get-commented 'lyskom-edit-insert-commented))
(defun kom-edit-insert-buglist ()
"Insert the commented buglist, Roxen Internet Software style."
(interactive)
(lyskom-edit-get-commented 'lyskom-edit-insert-buglist))
(defun kom-edit-insert-digit-text ()
(interactive)
(setq unread-command-events (cons last-command-event unread-command-events))
......@@ -1016,7 +1022,7 @@ Cannot be called from a callback."
(defun kom-edit-insert-text (no)
"Insert the text number NO with '>' first on each line"
"Insert the text number NO with '>' first on each line."
(interactive (list
(cond
((null current-prefix-arg)
......@@ -1731,6 +1737,48 @@ The text is inserted in the buffer with '>' first on each line."
(lyskom-message "%s" (lyskom-get-string 'no-get-text))))
;;; ========================================================================
;;; Treat the commented text as a Roxen Internet Software-style buglist,
;;; handling the removal of finished subjects, last-message changes et c
;;; Author: Johan Sundstrm
(defun lyskom-edit-insert-buglist (text text-stat editing-buffer window)
"Handles the TEXT and TEXT-STAT from the return of the call of the text.
The commented text is inserted in the buffer in the Roxen Internet Software
buglist style, automating the removal of finished subjects and change-marks."
(if (and text text-stat)
(let ((str (text->decoded-text-mass text text-stat)))
(set-buffer editing-buffer)
(and (not (bolp))
(insert "\n"))
(and (not (eolp))
(open-line 1))
(let* ((pb (point))
(as (string-match "\n" str))
(te (substring str (1+ as))))
(insert te)
(while (re-search-backward "^[ \t]*[!*X][ \t(]*\\[" nil t)
(replace-regexp "^\\([ \t]*\\)[!*X]\\([ \t(]*\\[\\)" "\\1 \\2"))
(goto-char pb)
(while (re-search-forward "^[ \t([]*\\[[^\\/ ]\\]" nil t)
(beginning-of-line)
(let* ((df (point))
(dt (re-search-forward "^\\([^ \t][^ \t]\\|[ \t([]*\\[[\\/ ]\\]\\)"
nil t)))
(if dt
(progn
(goto-char dt)
(beginning-of-line)
(if (thing-at-point-looking-at "^[^ \t]")
(progn
(beginning-of-line)
(forward-char -1))))
(goto-char (point-max)))
(delete-region df (point))))))
(lyskom-message "%s" (lyskom-get-string 'no-get-text))))
;;; ================================================================
;;; Maphanteringsfunktion - keymap handling.
......
......@@ -96,6 +96,7 @@
(define-key lyskom-sv-edit-prefix (kbd "C-i ?") 'lyskom-help)
(define-key lyskom-sv-edit-prefix (kbd "C-i C-k") 'kom-edit-insert-commented)
(define-key lyskom-sv-edit-prefix (kbd "C-y") 'kom-edit-insert-commented)
(define-key lyskom-sv-edit-prefix (kbd "C-b") 'kom-edit-insert-buglist)
(define-key lyskom-sv-edit-prefix (kbd "C-i 1") 'kom-edit-insert-digit-text)
(define-key lyskom-sv-edit-prefix (kbd "C-i 2") 'kom-edit-insert-digit-text)
(define-key lyskom-sv-edit-prefix (kbd "C-i 3") 'kom-edit-insert-digit-text)
......@@ -1728,6 +1729,7 @@ Du m
(kom-edit-add-copy . "Addera extra kopiemottagare")
(kom-edit-show-commented . "terse det kommenterade")
(kom-edit-insert-commented . "Citera det kommenterade")
(kom-edit-insert-buglist . "Klistra in kommenterad buglista")
(kom-edit-add-bcc . "Addera fr knnedom")
(kom-edit-add-cross-reference . "Addera korsreferens")
(kom-edit-add-no-comments . "Begr inga kommentarer")
......
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