Commit df58bdfd authored by David Byers's avatar David Byers
Browse files

> 2002-12-31 David Byers <david.byers@swipnet.se>

>
> 	Improve kom-list-summary:
> 	* commands2.el (lyskom-do-list-summary): Damn. Already midnight.
> 	Don't print the subject on comments more than once in a row.
> 	(lyskom-print-summary-line): Don't compute subject here. Get it in
> 	a param instead.
>
> 2002-12-30  David Byers  <david.byers@swipnet.se>
>
> 	Improve kom-list-summary:
> 	* commands2.el (lyskom-print-summary-line): Print deep comment
> 	levels without additional indent, like nn does.
>
> 	Remove bugzilla links (text links supersede these):
> 	* lyskom-buttons.el (lyskom-button-transform-text): De-implemented
> 	bugzilla links.
> 	(lyskom-button-show-bugzilla-bug): Removed this function.
>
> 	* vars.el.in (kom-my-bugzilla): Removed this variable. Text links
> 	generalize bugzilla links.
> 	(lyskom-text-buttons): Removed bugzilla text buttons.
> 	(lyskom-button-actions): Same here.
>
> 	More text links:
> 	* lyskom-buttons.el (lyskom-button-add-links): New function.
> 	(lyskom-button-transform-text): Call it to create links from
> 	kom-text-links.
>
> 	* vars.el.in (kom-text-links): New variable.
>
> 	* clienttypes.el (lyskom-create-lyskom-text-link): New function.
> 	(lyskom-text-link->pattern): New function.
> 	(lyskom-text-link->replacement): New function.
> 	(lyskom-text-link->highlight): New function.
> 	(lyskom-text-link->ignore-case): New function.
>
> 	New nameday lists from Hans Persson:
> 	* names.el (sv-1993): New nameday list.
> 	(sv-pre-1901): Renamed nameday list from sv-1901
> 	(sv-1901): New nameday list.
> 	(sv-1986): New nameday list.
>
> 2002-12-22  David Byers  <david.byers@swipnet.se>
>
> 	Work on bug 946:
> 	* commands2.el (lyskom-do-list-summary): Display texts in comment
> 	order with indentation.
> 	(lyskom-print-summary-line): Support indentation.
>
> 2002-12-18  David Byers  <david.byers@swipnet.se>
>
> 	* lyskom-buttons.el (lyskom-button-transform-text): Added
> 	text-stat argument.
>
> 	Implement text links:
> 	* lyskom-rest.el (lyskom-format-ö): Pass text-stat to
> 	lyskom-button-transform-text.
> 	(lyskom-format-enriched): Ditto.
> 	(lyskom-format-text-body): Ditto.
> 	(lyskom-format-aux-help): Handle cons in format-letter r.
>
> 	* view-text.el: Send the text-stat when formatting subject.
>
> 2002-12-17  David Byers  <david.byers@swipnet.se>
>
> 	Work on bug 753:
> 	* flags.el (lyskom-read-options): Added optional buffer argument
> 	to support reading settings from a different session.
>
parent 5427fd68
2002-12-31 David Byers <david.byers@swipnet.se>
Improve kom-list-summary:
* commands2.el (lyskom-do-list-summary): Damn. Already midnight.
Don't print the subject on comments more than once in a row.
(lyskom-print-summary-line): Don't compute subject here. Get it in
a param instead.
2002-12-30 David Byers <david.byers@swipnet.se>
Improve kom-list-summary:
* commands2.el (lyskom-print-summary-line): Print deep comment
levels without additional indent, like nn does.
Remove bugzilla links (text links supersede these):
* lyskom-buttons.el (lyskom-button-transform-text): De-implemented
bugzilla links.
(lyskom-button-show-bugzilla-bug): Removed this function.
* vars.el.in (kom-my-bugzilla): Removed this variable. Text links
generalize bugzilla links.
(lyskom-text-buttons): Removed bugzilla text buttons.
(lyskom-button-actions): Same here.
More text links:
* lyskom-buttons.el (lyskom-button-add-links): New function.
(lyskom-button-transform-text): Call it to create links from
kom-text-links.
* vars.el.in (kom-text-links): New variable.
* clienttypes.el (lyskom-create-lyskom-text-link): New function.
(lyskom-text-link->pattern): New function.
(lyskom-text-link->replacement): New function.
(lyskom-text-link->highlight): New function.
(lyskom-text-link->ignore-case): New function.
New nameday lists from Hans Persson:
* names.el (sv-1993): New nameday list.
(sv-pre-1901): Renamed nameday list from sv-1901
(sv-1901): New nameday list.
(sv-1986): New nameday list.
2002-12-22 David Byers <david.byers@swipnet.se>
Work on bug 946:
* commands2.el (lyskom-do-list-summary): Display texts in comment
order with indentation.
(lyskom-print-summary-line): Support indentation.
2002-12-18 David Byers <david.byers@swipnet.se>
* lyskom-buttons.el (lyskom-button-transform-text): Added
text-stat argument.
Implement text links:
* lyskom-rest.el (lyskom-format-): Pass text-stat to
lyskom-button-transform-text.
(lyskom-format-enriched): Ditto.
(lyskom-format-text-body): Ditto.
(lyskom-format-aux-help): Handle cons in format-letter r.
* view-text.el: Send the text-stat when formatting subject.
2002-12-17 David Byers <david.byers@swipnet.se>
Work on bug 753:
* flags.el (lyskom-read-options): Added optional buffer argument
to support reading settings from a different session.
2002-12-17 Ulrik Haugen <qha@lysator.liu.se>
* startup.el (lyskom-read-server-name): Updated docstring wrt.
......
......@@ -678,6 +678,33 @@ The element last pushed is first in the list."
"Push VALUE onto the front of COLLECTOR's value"
(setcdr collector (cons value (cdr collector))))
;;; ================================================================
;;; Specification for text links (cached)
;;;
;;; We don't use def-komtype since the accessors should be able to
;;; work on user settings too.
(defun lyskom-create-lyskom-text-link (pattern replacement
highlight ignore-case)
(cons 'LYSKOM-TEXT-LINK (vector pattern replacement highlight ignore-case)))
(defsubst lyskom-text-link->pattern (link)
(if (symbolp (car link)) (elt (cdr link) 0) (elt link 0)))
(defsubst lyskom-text-link->replacement (link)
(if (symbolp (car link)) (elt (cdr link) 1) (elt link 1)))
(defsubst lyskom-text-link->highlight (link)
(if (symbolp (car link)) (elt (cdr link) 2) (elt link 2)))
(defsubst lyskom-text-link->ignore-case (link)
(if (symbolp (car link)) (elt (cdr link) 3) (elt link 3)))
(eval-and-compile (provide 'lyskom-clienttypes))
;;; clienttypes.el ends here
......@@ -1024,6 +1024,7 @@ the text on one line."
The summary contains the date, number of lines, author and subject of the text
on one line."
(let ((time (lyskom-current-server-time))
(indent 0)
(unique-subjects nil))
;; The header.
......@@ -1035,40 +1036,51 @@ on one line."
(lyskom-get-string 'Subject))
;; The summary lines.
(lyskom-traverse
text-no texts
(let ((text-stat (blocking-do 'get-text-stat text-no))
(text (blocking-do 'get-text text-no))
;; We could do som optimization here.
;; We really don't need the whole text.
)
(when (or (not unique)
(let* ((txt (text->decoded-text-mass text text-stat))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos)))
(and (not (lyskom-string-member subject unique-subjects))
(setq unique-subjects (cons subject unique-subjects)))))
(lyskom-print-summary-line (lyskom-construct-summary-format-string nil nil)
text-stat text text-no
(time->year time)
(time->mon time)
(time->mday time)))
(sit-for 0)))))
(defun lyskom-print-summary-line (format-string text-stat text text-no year mon mday)
(let ((text-no nil)
(last-subject ""))
(while texts
(setq text-no (car texts) texts (cdr texts))
(cond
((eq text-no 'in) (setq indent (1+ indent)))
((eq text-no 'out) (setq indent (1- indent)))
(t (blocking-do-multiple ((text-stat (get-text-stat text-no))
(text (get-text text-no)))
(let* ((txt (text->decoded-text-mass text text-stat))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos)))
(when (or (not unique)
(and (not (lyskom-string-member subject unique-subjects))
(setq unique-subjects (cons subject unique-subjects))))
(lyskom-print-summary-line
(lyskom-construct-summary-format-string nil nil)
text-stat
(if (and (> indent 0) (string-equal subject last-subject))
""
subject)
text-no
(time->year time)
(time->mon time)
(time->mday time)
indent))
(setq last-subject subject)
(let ((comments (lyskom-text-comments text-stat)))
(setq texts (cons 'out texts))
(lyskom-traverse comment-no (nreverse comments)
(when (memq comment-no texts)
(setq texts (cons comment-no (delq comment-no texts)))))
(setq texts (cons 'in texts)))))
(sit-for 0)))))))
(defun lyskom-print-summary-line (format-string text-stat subject text-no year mon mday indent)
"Handle the info, fetch the author and print it.
Args: FORMAT-STRING TEXT-STAT TEXT TEXT-NO YEAR MON MDAY.
The year, mon and mday are there to be able to choose format on the
day. Format is HH:MM(:SS) if the text is written today, otherwise
YYYY-MM-DD."
(if (not (and text-stat text)) ;+++ B{ttre felhantering.
(if (null text-stat) ;+++ B{ttre felhantering.
(lyskom-format-insert 'could-not-read text-no)
(let* ((lines (text-stat->no-of-lines text-stat))
(txt (text->decoded-text-mass text text-stat))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos))
(mx-date (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 21)))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
......@@ -1086,9 +1098,12 @@ YYYY-MM-DD."
(if (or mx-from mx-author)
(lyskom-format-mx-author mx-from mx-author)
(text-stat->author text-stat))
(lyskom-default-button 'text
text-no)
subject))))
(lyskom-default-button 'text text-no)
(concat
(if (>= indent 10)
(format ">>>[%d]>>>" indent)
(make-string indent ?\>))
subject)))))
(defun lyskom-max-text-no-width ()
......
......@@ -1695,7 +1695,6 @@ You must become an active member of the conference to enter it.\n")
(lyskom-button-open-url-action . "Open")
(lyskom-button-copy-url-action . "Copy")
(lyskom-button-goto-info-node-action . "Open")
(lyskom-button-show-bugzilla-bug-action . "Show in bugzilla")
(lyskom-button-open-email-action . "Send mail")
(lyskom-button-copy-email-action . "Copy")
(lyskom-button-info-aux-action . "Information")
......@@ -3686,11 +3685,6 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
\\& means substitute original matched text,
\\N means substitute match for (...) number N,
\\\\ means insert one \\.")
(kom-my-bugzilla-doc . "\
The elisp client attempts to locate references to bugs in bugzilla. This
setting specifies where the bugzilla server is located. The value must be
the base URL of the bugzilla server \(e.g. `http://bugzilla.example.com/'\).")
;;
;; Tags for variables
......@@ -3870,7 +3864,6 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-max-overlays-tag . "Maximum number of overlays:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Mark read texts read when added to new recipients:")
(kom-url-transformation-rules-tag . "Transformation of URLs:")
(kom-my-bugzilla-tag . "Location of bugzilla:")
)
)
......
......@@ -179,12 +179,16 @@
(lyskom-message "%s" error-message))))
(defun lyskom-read-options ()
(defun lyskom-read-options (&optional buffer)
"Reads the user-area and sets the variables according to the choises.
Returns a list of variables that were ignored."
Returns a list of variables that were ignored. If optional BUFFER is
non-nil, read settings in that buffer."
(if (and lyskom-pers-no
(not (zerop lyskom-pers-no)))
(let ((pers-stat (blocking-do 'get-pers-stat lyskom-pers-no)))
(let ((pers-stat
(save-excursion
(when buffer (set-buffer buffer))
(blocking-do 'get-pers-stat lyskom-pers-no))))
(if (not pers-stat) ;+++ Other error handler.
(progn (lyskom-insert-string 'you-dont-exist)
nil)
......@@ -195,8 +199,10 @@ Returns a list of variables that were ignored."
(setq lyskom-options-done t)
nil)
(lyskom-read-options-eval
(blocking-do 'get-text
(pers-stat->user-area pers-stat))))))
(save-excursion
(when buffer (set-buffer buffer))
(blocking-do 'get-text
(pers-stat->user-area pers-stat)))))))
nil))
(defun lyskom-read-options-eval (text)
......
......@@ -315,12 +315,49 @@ If there is no active area, then do something else."
url)))
(defun lyskom-button-transform-text (text)
(defun lyskom-button-add-links (text links)
"Add links to TEXT according to LINKS.
LINKS is a list of lyskom-text-link objects."
(lyskom-traverse spec links
(let ((case-fold-search (lyskom-text-link->ignore-case spec))
(start 0))
(while (string-match (lyskom-text-link->pattern spec) text start)
;; Need to do this here since replace-in-string fscks up match-data
(setq start (match-end 0))
(add-text-properties
(or (match-beginning (lyskom-text-link->highlight spec))
(match-beginning 0))
(or (match-end (lyskom-text-link->highlight spec))
(match-end 0))
(lyskom-generate-button 'url
nil
(replace-in-string
(match-string 0 text)
(lyskom-text-link->pattern spec)
(lyskom-text-link->replacement spec))
'kom-url-face)
text)))))
(defun lyskom-button-transform-text (text &optional text-stat)
"Add text properties to the string TEXT according to the definition of
lyskom-text-buttons. Returns the modified string."
(let ((blist lyskom-text-buttons)
(rcpts (reverse (lyskom-text-recipients text-stat)))
(start 0)
(el nil))
;; Do links from kom-text-links last -- they have precedence
;; Do the first recipient last so links for that rcpt have prio
(lyskom-traverse rcpt rcpts
(lyskom-button-add-links text (cdr (assq rcpt kom-text-links))))
;; Do global links from kom-text-links very last
(lyskom-button-add-links text (cdr (assq t kom-text-links)))
;; Do other text buttons
(while blist
(setq el (car blist))
(setq start 0)
......@@ -364,12 +401,7 @@ lyskom-text-buttons. Returns the modified string."
(lyskom-button-get-text el text)
(lyskom-button-get-face el)))
((eq (elt el 1) 'bugzilla)
(lyskom-generate-button 'bugzilla
(lyskom-button-get-arg el text)
(lyskom-button-get-text el text)
(lyskom-button-get-face el)))
((eq (elt el 1) 'email)
(lyskom-generate-button 'email
nil
......@@ -799,19 +831,6 @@ This is a LysKOM button action."
(compose-mail text)
(mail nil text)))
(defun lyskom-button-show-bugzilla-bug (buf arg text)
(let ((case-fold-search t)
(url ""))
(unless (string-match "^http" kom-my-bugzilla)
(setq url "http://"))
(setq url (concat url kom-my-bugzilla))
(unless (string-match "/$" url)
(setq url (concat url "/")))
(setq url (concat url "show_bug.cgi?id=" arg))
(lyskom-button-open-url buf
nil
url)))
(defun lyskom-button-copy-url (but arg text)
"In the LysKOM buffer BUF, ignore ARG and copy TEXT to the kill ring.
......
......@@ -1781,6 +1781,7 @@ Deferred insertions are not supported."
;;
((= format-letter ?r)
(setq result (cond ((stringp arg) (lyskom-button-transform-text arg))
((consp arg) (lyskom-button-transform-text (cdr arg) (car arg)))
(t (signal 'lyskom-internal-error
(list 'lyskom-format
": argument error (expected subject)")))))
......@@ -2008,7 +2009,8 @@ Deferred insertions are not supported."
(cond (formatted formatted)
(t (let ((tmp (if kom-text-properties
(lyskom-button-transform-text
(lyskom-fill-message text))
(lyskom-fill-message text)
text-stat)
(lyskom-fill-message text))))
(when (and kom-smileys
(fboundp 'smiley-region))
......@@ -2102,7 +2104,7 @@ in lyskom-messages."
(insert (substring text 10))
(format-decode-buffer)
(lyskom-signal-reformatted-text 'reformat-enriched)
(lyskom-button-transform-text (buffer-string))
(lyskom-button-transform-text (buffer-string) text-stat)
;; (substring (buffer-string) 0 -1) ; Remove the \n
)
(kill-buffer tmpbuf)))))
......@@ -2125,7 +2127,7 @@ in lyskom-messages."
(forward-line 1))
(lyskom-signal-reformatted-text 'reformat-filled)
(if kom-text-properties
(lyskom-button-transform-text (buffer-string))
(lyskom-button-transform-text (buffer-string) text-stat)
(buffer-substring (point-min) (1- (point-max))))))))
......
This diff is collapsed.
......@@ -232,7 +232,6 @@
[kom-mosaic-command]
[kom-netscape-command]
[kom-galeon-command]
[kom-my-bugzilla]
"\n\n"
section
......@@ -732,7 +731,6 @@ customize buffer but do not save them to the server."
(kom-keyboard-menu-immediate-selection (noggle (yes no)))
(kom-url-transformation-rules (repeat (cons ((string nil :tag url-transform-regexp)
(string nil :tag url-transform-newtext)))))
(kom-my-bugzilla (string))
))
(defvar lyskom-widget-functions
......
......@@ -1711,7 +1711,6 @@ Du m
(lyskom-button-open-url-action . "ppna")
(lyskom-button-copy-url-action . "Kopiera")
(lyskom-button-goto-info-node-action . "ppna")
(lyskom-button-show-bugzilla-bug-action . "Visa i bugzilla")
(lyskom-button-open-email-action . "Skicka mail")
(lyskom-button-copy-email-action . "Kopiera")
(lyskom-button-info-aux-action . "Information")
......@@ -3779,13 +3778,6 @@ i servern. Annars sparas det i din .emacs.")
\\& erstts med den text som matchar regexpen
\\N erstts med den text som matchar (...)-uttryck N i regexpen
\\\\ erstts med en \\.")
(kom-my-bugzilla-doc . "\
Elispklienten frsker hitta hnvisningar till buggar registrerade i
bugzilla. Den hr instllningen anger var bugzilla-servern finns.
Vrdet skall vara bas-URLen fr bugzilla \(till exempel
`http://bugzilla.example.com'\).")
;;
;; Tags for variables
......@@ -3965,7 +3957,6 @@ i servern. Annars sparas det i din .emacs.")
(kom-max-overlays-tag . "Hgsta antal frgmarkeringar:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Markera lsta inlgg lsta ven i nya mottagare:")
(kom-url-transformation-rules-tag . "Transformation av URLer:")
(kom-my-bugzilla-tag . "URL till bugzilla:")
)
)
......
......@@ -124,15 +124,19 @@ if the variable is in kom-dont-read-saved-variables."
;;; User flags
(def-kom-var kom-my-bugzilla "bugzilla.lysator.liu.se"
"*Location of bugzilla.
Either the base URL of bugzilla (e.g. `http://bugzilla.example.com/') or
the hostname where bugzilla is located (e.g. `bugzilla.example.com'), if
bugzilla is located in the root of the server.
Values other than a string are reserved for future use."
(def-kom-var kom-text-links nil
"*Links in the text.
This list is an alist where the car is a conference number and the cdr
a list of link specifications for that conference. Each link specification
is a list \(PATTERN REPLACEMENT HIGHLIGHT IGNORE-CASE), where PATTERN is
a regexp to look for in the text, REPLACEMENT is a replacement text to
generate a URL from a match for REGEXP (see the NEWTEXT argument to
replace-in-string for more information), HIGHLIGHT is the match group to
highlight in the LysKOM buffer (use 0 for the entire match) and IGNORE-CASE
is a flag: when non-nil case is ignored when looking for REGEXP."
server)
(defconst kom-old-farts-text-prompt-strategy
'((kom-comment-previous . ((t . lyskom-get-previous-text)
(nil . lyskom-get-previous-text)))
......@@ -1058,11 +1062,6 @@ conference and person buttons are not expected.")
("<(?person[ \t\n\r]*\\([0-9]+\\)\\([^0-9>]?\\|[^0-9>][^>]*\\))?>"
pers 0 1 nil)
;; Bugs
("\\<bugg?[ \t\n\r]+\\([0-9]+\\)"
bugzilla 0 1 kom-url-face)
;; Info node reference
("\\*Note[ \n\t]+\\([^:\n]*\\(\n[^:\n]*\\)?\\):\\s-*\\(\\(([^\)]+)\\)?[^.,\t\n]*\\(\n[^.,\t\n]*\\)?\\)[.,\t]"
......@@ -1562,11 +1561,6 @@ appear more than once"
lyskom-button-goto-info-node
((lyskom-button-goto-info-node-action . lyskom-button-goto-info-node))
nil)
(bugzilla
generic-popup-title
lyskom-button-show-bugzilla-bug
((lyskom-show-button-bugzilla-bug-action . lyskom-button-show-bugzilla-bug))
nil)
(email
generic-popup-title
lyskom-button-open-email
......
......@@ -852,14 +852,16 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO FLAT-REVIEW."
(lyskom-insert-string 'head-Subject)
(let ((lyskom-current-function-phase 'subject))
(lyskom-format-insert "%#1r\n"
(copy-sequence lyskom-current-subject)))
(lyskom-format-insert
"%#2$%#1s\n"
(if kom-dashed-lines
(make-string kom-text-header-dash-length ?-)
"")
(when kom-highlight-dashed-lines
'(face kom-dashed-lines-face)))
(cons text-stat
(copy-sequence
lyskom-current-subject))))
(lyskom-format-insert
"%#2$%#1s\n"
(if kom-dashed-lines
(make-string kom-text-header-dash-length ?-)
"")
(when kom-highlight-dashed-lines
'(face kom-dashed-lines-face)))
;; (setq t1 (point-max))
......
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