Commit ad4e292a authored by Linus Tolke Y's avatar Linus Tolke Y

Manipulation of process-kill-without-query.

parent 94d9a0c3
No preview for this file type
......@@ -654,10 +654,8 @@ If optional arg TEXT-NO is present write a comment to that text instead."
lyskom-current-text)
((integerp current-prefix-arg)
current-prefix-arg)
((and (listp current-prefix-arg)
(integerp (car current-prefix-arg))
(null (cdr current-prefix-arg)))
(car current-prefix-arg))
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-comment-no)))
(t
(signal 'lyskom-internal-error '(kom-write-comment))))))
(lyskom-start-of-command (concat
......@@ -685,10 +683,8 @@ If optional arg TEXT-NO is present write a footnote to that text instead."
lyskom-current-text)
((integerp current-prefix-arg)
current-prefix-arg)
((and (listp current-prefix-arg)
(integerp (car current-prefix-arg))
(null (cdr current-prefix-arg)))
(car current-prefix-arg))
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-comment-no)))
(t
(signal 'lyskom-internal-error '(kom-write-comment))))))
(lyskom-start-of-command 'kom-write-footnote)
......@@ -931,7 +927,13 @@ If optional argument is non-nil then dont ask for confirmation."
(interactive "P")
(lyskom-start-of-command 'kom-quit t)
(cond
((or arg (ja-or-nej-p (lyskom-get-string 'really-quit)))
((and (lyskom-count-down-edits)
(display-buffer (car lyskom-list-of-edit-buffers))
(not (ja-or-nej-p (lyskom-get-string 'quit-in-spite-of-unsent))))
(lyskom-end-of-command))
((or arg
(ja-or-nej-p (lyskom-get-string 'really-quit))
)
(initiate-logout 'main nil)
(set-process-sentinel lyskom-proc nil)
(delete-process lyskom-proc)
......@@ -1693,9 +1695,12 @@ MY-SESSION-NO is the session number of the running session.
(defun lyskom-window-width ()
"Returns the width of the lyskom-window of the screen-width if not displayed."
(let ((win (get-buffer-window (current-buffer))))
(if win
(window-width win)
(screen-width))))
(cond
(win (window-width win))
((fboundp 'frame-width)
(frame-width))
(t
(screen-width)))))
(defun lyskom-return-username (who-info)
......
......@@ -63,6 +63,9 @@ Does lyskom-end-of-command."
(let ((buffer (generate-new-buffer
(concat (buffer-name (process-buffer proc)) "-edit")))
(config (current-window-configuration)))
(setq lyskom-list-of-edit-buffers (cons buffer
lyskom-list-of-edit-buffers))
(process-kill-without-query (get-buffer-process (current-buffer)) t)
(cond
((and (or (bufferp kom-write-texts-in-window)
(stringp kom-write-texts-in-window))
......@@ -249,7 +252,7 @@ Entry to this mode runs lyskom-edit-mode-hook."
(copy-keymap (current-local-map))))
(setq major-mode 'lyskom-edit-mode)
(setq mode-name lyskom-edit-mode-name)
(setq buffer-offer-save t)
;; (setq buffer-offer-save t)
(use-local-map (overlay-map lyskom-edit-mode-mode-map
lyskom-edit-mode-map))
(auto-save-mode 1)
......@@ -322,7 +325,8 @@ Entry to this mode runs lyskom-edit-mode-hook."
(lyskom-save-excursion
(set-buffer edit-buffer)
(delete-auto-save-file-if-necessary))
(kill-buffer edit-buffer))
(kill-buffer edit-buffer)
(lyskom-count-down-edits))
(garbage-collect)) ;Take care of the garbage.
......@@ -656,7 +660,6 @@ Point must be located on the line where the subject is."
(lyskom-run 'background 'set 'lyskom-dont-change-prompt nil)
(lyskom-run 'background 'lyskom-set-mode-line)))
(set-buffer edit-buffer) ;Need local variables.
;; Select the old configuration.
......@@ -683,7 +686,8 @@ Point must be located on the line where the subject is."
(lyskom-save-excursion
(set-buffer edit-buffer)
(delete-auto-save-file-if-necessary))
(kill-buffer edit-buffer))))
(kill-buffer edit-buffer)
(lyskom-count-down-edits))))
(defun lyskom-edit-show-commented (text editing-buffer)
......@@ -720,6 +724,30 @@ The text is inserted in the buffer with '>' first on each line."
(lyskom-message "%s" (lyskom-get-string 'no-get-text))))
(defun lyskom-count-down-edits ()
"Counts down the number of edit sessions.
Returns non-nil if there are sessions left.
Can be called from any of the lyskom-associated buffers. At least the main
buffer and edit buffers."
(save-excursion
(let ((proc (or (get-buffer-process (current-buffer))
(and (boundp 'lyskom-proc)
(processp lyskom-proc)
lyskom-proc)
(signal 'lyskom-internal-error
"lyskom-count-down-edits called from "
(current-buffer)))))
(set-buffer (process-buffer proc))
(while (and lyskom-list-of-edit-buffers
(not (memq (car lyskom-list-of-edit-buffers) (buffer-list))))
(setq lyskom-list-of-edit-buffers (cdr lyskom-list-of-edit-buffers)))
(if lyskom-list-of-edit-buffers
(process-kill-without-query proc t)
(process-kill-without-query proc nil)))
lyskom-list-of-edit-buffers))
;;; ================================================================
;;; Maphanteringsfunktion - keymap handling.
;;;
......@@ -779,6 +807,3 @@ BUG: does not descend in the maps."
(cdr ele))))
(cdr newmap))))
map))))
......@@ -496,6 +496,7 @@ Entry to this mode runs lyskom-mode-hook."
(setq mode-name "LysKOM")
(setq mode-line-process '(": %s"))
(use-local-map lyskom-mode-map)
(lyskom-count-down-edits)
(run-hooks 'lyskom-mode-hook))
......@@ -564,6 +565,7 @@ Entry to this mode runs lyskom-mode-hook."
(make-local-variable 'mode-line-conf-name)
(make-local-variable 'lyskom-output-queue)
(make-local-variable 'lyskom-options-done)
(make-local-variable 'lyskom-list-of-edit-buffers)
(setq lyskom-proc proc)
(setq lyskom-pers-no pers-no)
(setq lyskom-membership membership)
......@@ -574,4 +576,5 @@ Entry to this mode runs lyskom-mode-hook."
(setq lyskom-server-info server-info)
(setq lyskom-do-when-done (cons kom-do-when-done kom-do-when-done))
(setq lyskom-output-queue (lyskom-queue-create))
(setq lyskom-list-of-edit-buffers nil)
(lyskom-set-mode-line (lyskom-get-string 'not-present-anywhere))))
......@@ -225,11 +225,13 @@ Skicka ett brev till %#2s f\366r medlemsskap.\n")
(anyone-member . "F\345r vem som helst bli medlem? ")
(secret-conf . "Hemligt m\366te? ")
(comments-allowed . "F\345r man skriva kommentarer? ")
(what-comment-no . "Kommentera text nummer: ")
(confusion-what-to-comment . "Jag f\366rst\345r inte vilken text du vill kommentera.\n")
(confusion-what-to-footnote . "Jag f\366rst\345r inte vilken text du vill skriva en fotnot till.\n")
(confusion-who-to-reply-to . "Jag f\366rst\345r inte vems inl\344gg du vill skriva ett privat svar till.\n")
(confusion-what-to-answer-to . "Jag f\366rst\345r inte vilken text du vill besvara.")
(quit-in-spite-of-unsent . "Vill du avsluta sessionen trots os\344nt meddelande? ")
(really-quit . "Vill du verkligen avsluta sessionen? ")
(session-ended . "
*****************************
......
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