Commit 912ef978 authored by Ulrik Haugen's avatar Ulrik Haugen
Browse files

Created kom-edit-add-link and friends.

parent dad94148
2001-08-16 Ulrik Haugen <qha@lysator.liu.se>
* edit-text.el (kom-edit-add-link): new. Inserts a link
in the text you are writing.
* commands1.el (lyskom-read-link): new. Returns a link to a text,
person or conference.
* swedish-strings.el (lyskom-message): added messages for
link-insertion.
(lyskom-sv-edit-mode-map): C-c C-a C-l runs kom-edit-add-link.
* english-strings.el (lyskom-en-edit-mode-map):
(lyskom-message): see swedish-strings.el
2001-08-09 Ulrik Haugen <qha@lysator.liu.se>
* lyskom-buttons.el (lyskom-button-find-root-review): this
......
......@@ -3889,6 +3889,51 @@ corresponding aux-item."
(format "%s%d" char obj)))))
(defun lyskom-read-link ()
"Query user about link type and value, and return the corresponding
aux-item."
(let* ((completions (list (cons (lyskom-get-string 'conference) 'conf)
(cons (lyskom-get-string 'person) 'pers)
(cons (lyskom-get-string 'text) 'text)))
(completion-ignore-case t)
(type (cdr (lyskom-string-assoc
(lyskom-completing-read
(lyskom-get-string 'link-type)
(lyskom-maybe-frob-completion-table
completions)
nil
t)
completions)))
(obj nil)
(prompt nil))
(cond
((eq type 'text)
(setq prompt (lyskom-get-string 'which-text-to-link))
(while (null obj)
(setq obj (blocking-do 'get-text-stat
(lyskom-read-number prompt)))
(setq prompt (lyskom-get-string 'which-text-to-link-err )))
(let* ((text-no (text-stat->text-no obj))
(text (blocking-do 'get-text text-no))
(txt (text->decoded-text-mass text obj))
(eos (string-match (regexp-quote "\n") txt))
(subject (substring txt 0 eos)))
(format "<text %d: %s>" text-no subject)))
((eq type 'conf)
(setq prompt (lyskom-get-string 'which-conf-to-link))
(while (null obj)
(setq obj (lyskom-read-conf-stat prompt '(conf) nil nil t)))
(format "<möte %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj)))
((eq type 'pers)
(setq prompt (lyskom-get-string 'which-pers-to-link))
(while (null obj)
(setq obj (lyskom-read-conf-stat prompt '(pers) nil nil t)))
(format "<person %d: %s>" (conf-stat->conf-no obj)
(conf-stat->name obj))))))
;;; ================================================================
;;; Local Variables:
......
......@@ -1308,7 +1308,12 @@ RECPT-TYPE is the type of recipient to add."
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0 "")))
(defun kom-edit-add-link ()
(interactive)
(let ((item (lyskom-read-link)))
(when item
(insert item))))
......
......@@ -107,6 +107,7 @@
(define-key lyskom-en-edit-prefix (kbd "C-a C-c") 'kom-edit-add-copy)
(define-key lyskom-en-edit-prefix (kbd "C-a <RET>") 'kom-edit-move-text)
(define-key lyskom-en-edit-prefix (kbd "C-a C-x") 'kom-edit-add-cross-reference)
(define-key lyskom-en-edit-prefix (kbd "C-a C-l") 'kom-edit-add-link)
(define-key lyskom-en-edit-prefix (kbd "C-x C-p") 'kom-edit-add-personal-comments)
(define-key lyskom-en-edit-prefix (kbd "C-x C-n") 'kom-edit-add-no-comments)
(define-key lyskom-en-edit-prefix (kbd "C-x C-r") 'kom-edit-add-read-confirm-request)
......@@ -834,6 +835,12 @@ Help: \\[describe-mode] ---")
(transform-error . "Send unformatted (%#1s)? ")
(cant-find-info-node . "Can't find the info buffer")
(link-type . "What to you want to link to (text, conference or person)? ")
(which-text-to-link . "Add link to text: ")
(which-text-to-link-err . "Text not found. Add link to text: ")
(which-pers-to-link . "Add link to user: ")
(which-conf-to-link . "Add link to conference: ")
; From view-text.el:
(line . " /1 line/ ")
(lines ." /%#1d lines/ ")
......
......@@ -118,6 +118,7 @@
(define-key lyskom-sv-edit-prefix (kbd "C-a <LFD>") 'kom-edit-add-recipient)
(define-key lyskom-sv-edit-prefix (kbd "C-a C-k") 'kom-edit-add-comment)
(define-key lyskom-sv-edit-prefix (kbd "C-a C-x") 'kom-edit-add-cross-reference)
(define-key lyskom-sv-edit-prefix (kbd "C-a C-l") 'kom-edit-add-link)
(define-key lyskom-sv-edit-prefix (kbd "C-x C-p") 'kom-edit-add-personal-comments)
(define-key lyskom-sv-edit-prefix (kbd "C-x C-n") 'kom-edit-add-no-comments)
(define-key lyskom-sv-edit-prefix (kbd "C-x C-b") 'kom-edit-add-read-confirm-request)
......@@ -833,6 +834,12 @@ Annat se \\[describe-mode] ---")
(transform-error . "Skicka in oformatterat (%#1s)? ")
(cant-find-info-node . "Hittar inte info-bufferten")
(link-type . "Vad vill du lnka till (inlgg, mte eller person)? ")
(which-text-to-link . "Lgg in lnk till text nummer: ")
(which-text-to-link-err . "Hittar inte texten. Lgg in lnk till text nummer: ")
(which-pers-to-link . "Lgg in lnk till person: ")
(which-conf-to-link . "Lgg in lnk till mte: ")
;; From view-text.el:
(line . " /1 rad/ ")
(lines ." /%#1d rader/ ")
......
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