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

Lade till Arkivera på kontextmenyn för inlägg.

Defaultfil att arkivera inlägg på går att sätta per LysKOM
Fixade detaljer och felmeddelanden kring nya anrop till lyskom-read-text-no-prefix-arg
parent fcc88f3e
2000-06-02 David Byers <davby@ida.liu.se>
* lyskom-rest.el (kom-save-text): Use lyskom-saved-file to save
the most recently specified file name.
* lyskom-buttons.el (lyskom-button-save-text): New function.
* lyskom-rest.el (kom-save-text): Accept list of texts to save as
argument.
* swedish-strings.el: Lade till arkivera i kontextmenyn fr
inlggsnummer.
* vars.el.in (kom-saved-file-name): New variable replaces
lyskom-saved-file.
* lyskom-rest.el (kom-save-text): Put the default file in the
minibuffer. Do not display the default file in the prompt. More
informative prompt (show number of texts if saving many or text
number if saving one). Expand file name.
* review.el (kom-find-root): Better error message.
(kom-find-root-review): Better error message.
......
......@@ -6,14 +6,6 @@ Att g
* INTRESSANTA SAKER
ALLA SOM ANVÄNDER LYSKOM-READ-TEXT-NO-PREFIX-ARG MÅSTE VARA BEREDDA PÅ
ATT RESULTATET ÄR NIL, VILKET DET BLIR OM MAN INTE HAR EN PROMPT MEN
HAR DEFAULTVÄRDE PÅ TEXTNUMRET!
Kontrollera alla användningar av (lyskom-insert 'have-to-read). En del
borde vara egna strängar.
Använd lyskom-read-text-no-prefix arg i alla funktioner där det är
meningsfullt. Följande är relevanta:
......@@ -66,10 +58,6 @@ Best
bara anta default om man inte ger prefixargument.
Det vore trevligt om "Arkivera inlägg (till fil)" fanns i kontextmenyn
för inläggsnummer också, samt om man kunde ställa in en defaultpath
till funktionen, helst också per KOM.
** Blockera eller klara av att man ger kommandon i
kom-handle-membership medan bufferten håller på att uppdateras.
......
......@@ -1509,7 +1509,7 @@ You must become an active member of the conference to enter it.\n")
(kom-set-super-conf . "Change superconference")
(kom-set-permitted-submitters . "Change allowed authors")
(kom-unset-conf-motd . "Remove notice")
(kom-save-text . "Archive text (in file)")
(kom-save-text . "Archive (copy of) text (in file)")
(kom-save-text-body . "Save text body (in file)")
(kom-save-options . "Save options")
(kom-shutdown-server . "Shut down (server)")
......@@ -3216,7 +3216,9 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
("Write commend" . lyskom-button-comment-text)
("Write personal reply" . lyskom-button-private-comment-text)
("Mark text" . lyskom-button-mark-text)
("Unmark text" . lyskom-button-unmark-text))
("Unmark text" . lyskom-button-unmark-text)
("Save archive copy" . lyskom-button-save-text)
)
nil
; ((nil lyskom-print-text footer lyskom-button-comment-text))
)
......
......@@ -608,6 +608,14 @@ This is a LysKOM button action."
(lyskom-start-of-command 'kom-unmark-text)
(lyskom-unmark-text arg))
(lyskom-end-of-command)))))
(defun lyskom-button-save-text (buf arg text)
"In the LysKOM buffer BUF, save the text ARG. Last argument TEXT is ignored.
This is a LysKOM button action."
(cond ((not (integerp arg)) nil)
(t (unwind-protect
(progn (pop-to-buffer buf)
(kom-save-text nil (list arg)))))))
(defun lyskom-button-view-conf-presentation (buf arg text)
......
......@@ -2216,7 +2216,7 @@ A list of pairs means OPTARG will be used as a key to look up the real
(lyskom-next-area (or arg 1) 'lyskom-text-start))
(def-kom-command kom-save-text (&optional arg)
(def-kom-command kom-save-text (arg &optional list-of-texts)
"Saves/appends the article before point to a file.
The article is determined by a search-backward the same as backward-text
and then a forward-text.
......@@ -2225,41 +2225,49 @@ The name of the file is read using the minibuffer and the default is kom-text."
(interactive "p")
(let ((buf (lyskom-get-buffer-create 'temp " *kom*-text" t))
(lyskom-print-complex-dates nil)
(list-of-texts nil)
(kom-deferred-printing nil)
(name nil))
(unwind-protect
(save-excursion
(while (> arg 0)
(backward-text 1)
(if (looking-at "\\([0-9]+\\)\\s-")
(setq list-of-texts (cons (string-to-int (match-string 1))
list-of-texts)
arg (1- arg))
(setq arg 0)))
(set-buffer buf)
(setq kom-deferred-printing nil)
(erase-buffer)
(mapcar (function
(lambda (n)
(lyskom-view-text n)
(goto-char (point-max))
(insert "\n")))
list-of-texts)
(setq name (read-file-name
(lyskom-format 'save-on-file-q
(file-name-nondirectory
lyskom-saved-file-name))
(file-name-directory lyskom-saved-file-name)
lyskom-saved-file-name
nil))
(when (file-directory-p name)
(setq name (concat (file-name-as-directory name)
(file-name-nondirectory
lyskom-saved-file-name))))
(append-to-file (point-min) (point-max) (expand-file-name name))
(setq lyskom-saved-file-name name))
)))
(save-excursion
(while (and arg (> arg 0))
(backward-text 1)
(if (looking-at "\\([0-9]+\\)\\s-")
(setq list-of-texts (cons (string-to-int (match-string 1))
list-of-texts)
arg (1- arg))
(setq arg 0)))
(set-buffer buf)
(setq kom-deferred-printing nil)
(erase-buffer)
(mapcar (function
(lambda (n)
(lyskom-view-text n)
(goto-char (point-max))
(insert "\n")))
list-of-texts)
(setq name (expand-file-name
(read-file-name
(if (eq 1 (length list-of-texts))
(lyskom-format 'save-one-on-file-q (car list-of-texts))
(lyskom-format 'save-many-on-file-q (length list-of-texts)))
(file-name-directory (or lyskom-saved-file-name kom-saved-file-name))
nil
nil
(file-name-nondirectory (or lyskom-saved-file-name kom-saved-file-name)))))
(cond ((file-directory-p name)
(lyskom-format-insert 'cant-save-to-directory name))
(t
(set-buffer lyskom-buffer)
(if (eq 1 (length list-of-texts))
(lyskom-format-insert-before-prompt 'saving-one-on-file
(car list-of-texts)
name)
(lyskom-format-insert-before-prompt 'saving-many-on-file
(length list-of-texts)
name))
(set-buffer buf)
(append-to-file (point-min) (point-max) name)
(setq lyskom-saved-file-name name))
))))
(def-kom-command kom-save-text-body (text-no &optional filename)
"Save the body of text TEXT-NO to file FILENAME."
......
......@@ -151,6 +151,7 @@
[kom-follow-comments-outside-membership]
[kom-created-texts-are-read]
"\n"
[kom-saved-file-name]
[kom-default-mark]
[kom-membership-default-priority]
[kom-membership-default-placement]
......@@ -648,6 +649,7 @@ customize buffer but do not save them to the server."
(kom-complete-numbers-before-names (toggle (on off)))
(kom-keep-alive-interval (number))
(kom-prompt-for-text-no (repeat (command nil :tag command)))
(kom-saved-file-name (file))
))
(defvar lyskom-widget-functions
......
......@@ -996,7 +996,10 @@ Du b
(several-unread . "%#1M - %#2d olsta\n")
(enter-conf . "%#1M\n")
(save-on-file-q . "Arkivera inlgg till fil: (%#1s) ")
(save-one-on-file-q . "Arkivera inlgg %#1n till fil: ")
(save-many-on-file-q . "Arkivera %#1d inlgg till fil: ")
(saving-one-on-file . "Arkiverar inlgg %#1n i %#2s.\n")
(saving-many-on-file . "Arkivera %#1d inlgg i %#2s.\n")
(save-text-to-file-q . "Spara inlggstext %#1n p fil: ")
(save-text-confirm . "Filen %#1s finns redan. Vill du skriva ver den? ")
(saving-text . "Sparar inlgg %#1n som %#2s...")
......@@ -3112,6 +3115,9 @@ i servern. Annars sparas det i din .emacs.")
Dessa kommandon kommer alltid att frga efter textnummer om man inte
anger ngot explicit med prefixargument. Kommaondon som inte str med
hr kommer att gissa ett textnummer och inte frga.")
(kom-saved-file-name-doc . "\
Anger vilken fil som inlgg skall arkiveras till. Klienten kommer nd
att frga, men detta blir det frifyllda svaret.")
;;
;; Tags for variables
......@@ -3262,6 +3268,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-complete-numbers-before-names-tag . "Ls mtesnummer fre mtesnamn")
(kom-keep-alive-interval-tag . "Intervall fr hll frbindelsen igng")
(kom-prompt-for-text-no-tag . "Kommandon som skall frga efter textnummer")
(kom-saved-file-name-tag . "Fil att arkivera inlgg i")
)
)
......@@ -3300,7 +3307,9 @@ i servern. Annars sparas det i din .emacs.")
("Kommentera texten" . lyskom-button-comment-text)
("Personligt svar" . lyskom-button-private-comment-text)
("Markera texten" . lyskom-button-mark-text)
("Avmarkera texten" . lyskom-button-unmark-text))
("Avmarkera texten" . lyskom-button-unmark-text)
("Arkivera" . lyskom-button-save-text)
)
nil
; ((nil lyskom-print-text footer lyskom-button-comment-text))
)
......
......@@ -1740,8 +1740,13 @@ set to that text."
(def-kom-var lyskom-last-added-bccrcpt 0
"The default conference when adding a bccrecipient.")
(def-kom-var lyskom-saved-file-name (concat default-directory "kom-text")
"The default file name when saving a lyskom-text.")
(def-kom-var kom-saved-file-name (concat default-directory "kom-text")
"*The default file name when saving a LysKOM text."
server)
(def-kom-var lyskom-saved-file-name nil
"After saving once, the default file name when saving a LysKOM text."
local)
(def-kom-var lyskom-mode-hook nil
"*Hook to run when lyskom-mode is entered.")
......
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