Commit 29703deb authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New command: "Compare two texts".

parent 434eeae3
2002-02-09 Per Cederqvist <ceder@lysator.liu.se>
New command: "Compare two texts".
* vars.el.in (lyskom-commands): Added kom-compare-texts.
* swedish-strings.el (lyskom-message): Added diff-what-text-new
and diff-what-text-old.
(lyskom-command): Added kom-compare-texts.
(lyskom-help-strings): Added kom-compare-texts.
* english-strings.el (lyskom-message): Added diff-what-text-new
and diff-what-text-old.
(lyskom-command): Added kom-compare-texts.
* commands2.el (kom-compare-texts): New command.
* commands1.el (lyskom-text-stat-commented-texts): New function.
(lyskom-view-commented-text): Extract the computation of the
commented texts to lyskom-text-stat-commented-texts, so that it
can be reused by kom-compare-texts.
2002-02-04 Johan Sundström <jhs@lysator.liu.se>
* view-text.el
......
......@@ -302,24 +302,30 @@ the other ones."
(blocking-do 'get-text-stat lyskom-previous-text)))
(t (lyskom-insert-string 'confusion-what-to-view))))
(defun lyskom-view-commented-text (text-stat)
"Handles the return from the initiate-get-text-stat, displays and builds list."
(defun lyskom-text-stat-commented-texts (text-stat)
"Return a list of the text-nos that TEXT-STAT is a comment or footnote to."
(let* ((misc-info-list (and text-stat
(text-stat->misc-info-list text-stat)))
(misc-infos (and misc-info-list
(append (lyskom-misc-infos-from-list
'COMM-TO misc-info-list)
(lyskom-misc-infos-from-list
'FOOTN-TO misc-info-list))))
(text-nos (and misc-infos
(mapcar
(function
(lambda (misc-info)
(if (equal (misc-info->type misc-info)
'COMM-TO)
(misc-info->comm-to misc-info)
(misc-info->footn-to misc-info))))
misc-infos))))
'FOOTN-TO misc-info-list)))))
(and misc-infos
(mapcar
(function
(lambda (misc-info)
(if (equal (misc-info->type misc-info)
'COMM-TO)
(misc-info->comm-to misc-info)
(misc-info->footn-to misc-info))))
misc-infos))))
(defun lyskom-view-commented-text (text-stat)
"Handles the return from the initiate-get-text-stat, displays and builds list."
(let ((text-nos (lyskom-text-stat-commented-texts text-stat)))
(if text-nos
(progn
(lyskom-format-insert 'review-text-no
......
......@@ -2545,3 +2545,36 @@ configurable variable `kom-review-marks-texts-as-read' in the current buffer."
(interactive)
(setq kom-review-marks-texts-as-read nil))
;;; ================================================================
;;; Jmfr tv texter - Compare two texts
;;; Run ediff-buffers on two texts.
;;; Author: Per Cederqvist
(def-kom-command kom-compare-texts (old new)
"Show differences between text OLD and NEW.
When called interactively, it will prompt for the NEW text first,
defaulting to the last viewed texts. The OLD text number will default
to the first text that NEW is a comment or footnote to."
(interactive
(let* ((n (lyskom-read-text-no-prefix-arg 'diff-what-text-new t))
(new-stat (blocking-do 'get-text-stat n))
(o (lyskom-read-number
'diff-what-text-old
(if (null new-stat)
(lyskom-error (lyskom-get-string 'no-such-text-no n))
(car (lyskom-text-stat-commented-texts new-stat))))))
(list o n)))
(let* ((old-text (blocking-do 'get-text old))
(old-text-stat (blocking-do 'get-text-stat old))
(new-text (blocking-do 'get-text new))
(new-text-stat (blocking-do 'get-text-stat new))
(old-buf (generate-new-buffer (format "%d" old)))
(new-buf (generate-new-buffer (format "%d" new))))
(set-buffer old-buf)
(insert (text->decoded-text-mass old-text old-text-stat))
(set-buffer-modified-p nil)
(set-buffer new-buf)
(insert (text->decoded-text-mass new-text new-text-stat))
(set-buffer-modified-p nil)
(ediff-buffers old-buf new-buf)))
......@@ -698,6 +698,8 @@ The message you were sending to %#1M was:
(does-not-exist . "Unknown command.") ; Only people fixing bugs or receiving bug reports should change these:
(summary-line . "%=-8#1n%#2s%4#3d %[%#4@%#5:P%] %[%#6@%#7r%]\n")
(diff-what-text-old . "Old text to compare: ")
(diff-what-text-new . "New text to compare: ")
; Only people fixing bugs or receiving bug reports should change these:
(buggreport-compilestart . "Creating bug report...")
......@@ -1786,8 +1788,11 @@ You must become an active member of the conference to enter it.\n")
(kom-add-no-comments . "Prevent comments")
(kom-add-private-answer . "Request private reply")
(kom-add-request-confirm . "Request confirmation of reading")
(kom-review-mail-headers . "Review mail headers")
(kom-compare-texts . "Compare two texts")
(kom-become-anonymous . "Become anonymous")
(kom-become-nonanonymous . "Become non-anonymous (come forth into the light)")
......
......@@ -675,6 +675,8 @@ Meddelandet du f
(multiple-choice . "Flera alternativ finns.")
(does-not-exist . "Detta kommando finns inte.")
(summary-line . "%=-8#1n%#2s%4#3d %[%#4@%#5:P%] %[%#6@%#7r%]\n")
(diff-what-text-old . "Gammal text att jmfra: ")
(diff-what-text-new . "Ny text att jmfra: ")
;; Only people fixing bugs or receiving bug reports should
......@@ -1786,6 +1788,9 @@ Du m
(kom-add-request-confirm . "Begr lsbekrftelse")
(kom-review-mail-headers . "terse brevhuvud")
(kom-compare-texts . "Jmfr tv texter")
(kom-become-anonymous . "Bli anonym")
(kom-become-nonanonymous . "Bli icke-anonym (trd fram ur skuggorna)")
......@@ -2180,6 +2185,10 @@ Beg
(kom-review-mail-headers . "\
terse brevhuvudet fr ett importerat sladdpostmeddelande.")
(kom-compare-texts . "\
Jmfr tv texter med hjlp av ediff.")
(kom-become-anonymous . "\
ndra klientens beteende s att du blir lite mer anonym. Det blir ven
enklare att skriva anonyma inlgg.")
......
......@@ -1760,6 +1760,9 @@ is a list of vectors, where each vector specifies an item.
kom-add-request-confirm
kom-review-mail-headers
kom-compare-texts
kom-become-anonymous
kom-become-nonanonymous
......
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