Commit 1dcdc47e authored by David Byers's avatar David Byers
Browse files

Update unreads in membership buffer. Position cursor correctly at end of command.

Detailed changes:
> 2004-07-19  David Byers  <byers@lysator.liu.se>
>
> 	Nicen up lyskom-end-of-command:
> 	* command.el (def-kom-command): Use make-symbol, not intern, to
> 	get an uninterned symbol for the macro. Added winsym to save
> 	selected window.
> 	(def-kom-emacs-command): Ditto.
> 	(def-kom-command): Select the correct window for
> 	lyskom-end-of-command so point can be moved to the end of the
> 	prompt in that window.
> 	(def-kom-emacs-command): Same here.
>
> 	Fix problem tracking unreads in membership buffer:
> 	* clienttypes.el (read-list-enter-text): When updating unreads,
> 	pass conf-no, not conf-stat, to lp--maybe-update-unreads.
>
parent bec35a53
2004-07-19 David Byers <byers@lysator.liu.se>
Nicen up lyskom-end-of-command:
* command.el (def-kom-command): Use make-symbol, not intern, to
get an uninterned symbol for the macro. Added winsym to save
selected window.
(def-kom-emacs-command): Ditto.
(def-kom-command): Select the correct window for
lyskom-end-of-command so point can be moved to the end of the
prompt in that window.
(def-kom-emacs-command): Same here.
Fix problem tracking unreads in membership buffer:
* clienttypes.el (read-list-enter-text): When updating unreads,
pass conf-no, not conf-stat, to lp--maybe-update-unreads.
2004-07-18 David Byers <byers@lysator.liu.se> 2004-07-18 David Byers <byers@lysator.liu.se>
* mship-edit.el (lp--maybe-update-unreads): Zero unreads are * mship-edit.el (lp--maybe-update-unreads): Zero unreads are
......
...@@ -172,7 +172,7 @@ Returns t if there was a conference to insert this text into." ...@@ -172,7 +172,7 @@ Returns t if there was a conference to insert this text into."
(conf-stat->conf-no (read-info->conf-stat read-info)))) (conf-stat->conf-no (read-info->conf-stat read-info))))
(read-info-enter-text-last read-info text-no) (read-info-enter-text-last read-info text-no)
(setq inserted t)))) (setq inserted t))))
(when inserted (lp--maybe-update-unreads recipient)) (when inserted (lp--maybe-update-unreads (conf-stat->conf-no recipient)))
inserted)) inserted))
......
...@@ -104,13 +104,15 @@ Note that :prompt-format requires an argument." ...@@ -104,13 +104,15 @@ Note that :prompt-format requires an argument."
(progn (message "!! Missing interactive declaration for %S; assuming \(interactive\)" cmd) (progn (message "!! Missing interactive declaration for %S; assuming \(interactive\)" cmd)
(setq forms (cons interactive-decl forms)) (setq forms (cons interactive-decl forms))
(setq interactive-decl '(interactive)))) (setq interactive-decl '(interactive))))
(let ((bufsym (intern (format "%S-start-buffer" cmd)))) (let ((bufsym (make-symbol (format "%S-start-buffer" cmd)))
(winsym (make-symbol (format "%S-start-window" cmd))))
`(defun ,cmd ,args `(defun ,cmd ,args
,doc ,doc
,(lyskom-fix-interactive-decl interactive-decl cmd) ,(lyskom-fix-interactive-decl interactive-decl cmd)
(let ((lyskom-command-point (point))) (let ((lyskom-command-point (point)))
(lyskom-start-of-command ',cmd ,may-interrupt ,dead-ok ,prompt-format) (lyskom-start-of-command ',cmd ,may-interrupt ,dead-ok ,prompt-format)
(let ((,bufsym (current-buffer))) (let ((,bufsym (current-buffer))
(,winsym (selected-window)))
(unwind-protect (unwind-protect
(condition-case nil (condition-case nil
(progn ,@forms) (progn ,@forms)
...@@ -118,9 +120,20 @@ Note that :prompt-format requires an argument." ...@@ -118,9 +120,20 @@ Note that :prompt-format requires an argument."
(lyskom-insert-before-prompt (lyskom-insert-before-prompt
(lyskom-get-string 'interrupted)))) (lyskom-get-string 'interrupted))))
(lyskom-save-excursion (lyskom-save-excursion
(when (buffer-live-p ,bufsym) (cond ((and (buffer-live-p ,bufsym)
(set-buffer ,bufsym)) (window-live-p ,winsym)
(lyskom-end-of-command))))))))) (eq (window-buffer ,winsym) ,bufsym))
(save-selected-window
(set-buffer ,bufsym)
(select-window ,winsym)
(lyskom-end-of-command)))
((buffer-live-p ,bufsym)
(set-buffer ,bufsym)
(lyskom-end-of-command))
(t (lyskom-end-of-command)))))))))))
;; ;;
;; def-kom-emacs-command works like def-kom-command, but the template ;; def-kom-emacs-command works like def-kom-command, but the template
...@@ -178,7 +191,8 @@ Note that :prompt-format requires an argument." ...@@ -178,7 +191,8 @@ Note that :prompt-format requires an argument."
(setq interactive-decl '(interactive)))) (setq interactive-decl '(interactive))))
(let ((rsym (intern (format "%S-running-as-kom-command" cmd))) (let ((rsym (intern (format "%S-running-as-kom-command" cmd)))
(bufsym (intern (format "%S-start-buffer" cmd)))) (bufsym (make-symbol (format "%S-start-buffer" cmd)))
(winsym (make-symbol (format "%S-start-window" cmd))))
`(defun ,cmd ,args `(defun ,cmd ,args
,doc ,doc
,(lyskom-fix-interactive-decl interactive-decl cmd) ,(lyskom-fix-interactive-decl interactive-decl cmd)
...@@ -187,7 +201,8 @@ Note that :prompt-format requires an argument." ...@@ -187,7 +201,8 @@ Note that :prompt-format requires an argument."
(progn (lyskom-start-of-command ',cmd ,may-interrupt ,dead-ok ,prompt-format) (progn (lyskom-start-of-command ',cmd ,may-interrupt ,dead-ok ,prompt-format)
(setq ,rsym t)) (setq ,rsym t))
(error nil)) (error nil))
(let ((,bufsym (current-buffer))) (let ((,bufsym (current-buffer))
(,winsym (selected-window)))
(unwind-protect (unwind-protect
(condition-case nil (condition-case nil
(progn ,@forms) (progn ,@forms)
...@@ -196,10 +211,19 @@ Note that :prompt-format requires an argument." ...@@ -196,10 +211,19 @@ Note that :prompt-format requires an argument."
(lyskom-get-string 'interrupted)))) (lyskom-get-string 'interrupted))))
(and ,rsym (and ,rsym
(lyskom-save-excursion (lyskom-save-excursion
(when (buffer-live-p ,bufsym) (cond ((and (buffer-live-p ,bufsym)
(set-buffer ,bufsym)) (window-live-p ,winsym)
(lyskom-end-of-command)))))))))) (eq (window-buffer ,winsym) ,bufsym))
(save-selected-window
(set-buffer ,bufsym)
(select-window ,winsym)
(lyskom-end-of-command)))
((buffer-live-p ,bufsym)
(set-buffer ,bufsym)
(lyskom-end-of-command))
(t (lyskom-end-of-command))))))))))))
(put 'def-kom-command 'edebug-form-spec (put 'def-kom-command 'edebug-form-spec
...@@ -628,38 +652,38 @@ chosen according to this" ...@@ -628,38 +652,38 @@ chosen according to this"
(defun lyskom-end-of-command () (defun lyskom-end-of-command ()
"Print prompt, maybe scroll, prefetch info." "Print prompt, maybe scroll, prefetch info."
(lyskom-save-excursion (lyskom-save-excursion
(message "") (message "")
(lyskom-clean-all-buffer-lists) (lyskom-clean-all-buffer-lists)
(while (and lyskom-to-be-printed-before-prompt (while (and lyskom-to-be-printed-before-prompt
(lyskom-queue->first lyskom-to-be-printed-before-prompt)) (lyskom-queue->first lyskom-to-be-printed-before-prompt))
(if (not (bolp)) (lyskom-insert "\n")) (if (not (bolp)) (lyskom-insert "\n"))
(lyskom-insert (car (lyskom-queue->first (lyskom-insert (car (lyskom-queue->first
lyskom-to-be-printed-before-prompt))) lyskom-to-be-printed-before-prompt)))
(lyskom-queue-delete-first lyskom-to-be-printed-before-prompt)) (lyskom-queue-delete-first lyskom-to-be-printed-before-prompt))
(setq lyskom-executing-command nil) (setq lyskom-executing-command nil)
(setq lyskom-current-command nil) (setq lyskom-current-command nil)
(setq lyskom-current-prompt nil) ; Already set in s-o-c really (setq lyskom-current-prompt nil) ; Already set in s-o-c really
(lyskom-scroll) (lyskom-scroll)
(setq mode-line-process (lyskom-get-string 'mode-line-waiting)) (setq mode-line-process (lyskom-get-string 'mode-line-waiting))
(if (pos-visible-in-window-p (point-max) (selected-window)) (if (pos-visible-in-window-p (point-max) (selected-window))
(lyskom-set-last-viewed)) (lyskom-set-last-viewed))
(lyskom-prefetch-and-print-prompt) (lyskom-prefetch-and-print-prompt)
(run-hooks 'lyskom-after-command-hook) (run-hooks 'lyskom-after-command-hook)
(when (and (lyskom-have-feature idle-time) (when (and (lyskom-have-feature idle-time)
(not lyskom-is-anonymous)) (not lyskom-is-anonymous))
(save-excursion (set-buffer lyskom-buffer) (save-excursion (set-buffer lyskom-buffer)
(initiate-user-active 'background nil))) (initiate-user-active 'background nil)))
(if kom-inhibit-typeahead (if kom-inhibit-typeahead
(discard-input)) (discard-input))
;; lyskom-pending-commands should probably be a queue or a stack. ;; lyskom-pending-commands should probably be a queue or a stack.
(when lyskom-pending-commands (when lyskom-pending-commands
(let ((command (car lyskom-pending-commands))) (let ((command (car lyskom-pending-commands)))
(setq lyskom-pending-commands (cdr lyskom-pending-commands)) (setq lyskom-pending-commands (cdr lyskom-pending-commands))
(if (symbolp command) (if (symbolp command)
(call-interactively command) (call-interactively command)
(eval command)))) (eval command))))
(when lyskom-slow-mode (when lyskom-slow-mode
(buffer-enable-undo)))) (buffer-enable-undo))))
(eval-and-compile (provide 'lyskom-command)) (eval-and-compile (provide 'lyskom-command))
......
...@@ -3090,8 +3090,9 @@ Set lyskom-current-prompt accordingly. Tell server what I am doing." ...@@ -3090,8 +3090,9 @@ Set lyskom-current-prompt accordingly. Tell server what I am doing."
(delete-region (point) (match-end 0)) (delete-region (point) (match-end 0))
(delete-region (point) (point-max)) (delete-region (point) (point-max))
(if saved-suffix (insert saved-suffix))))) (if saved-suffix (insert saved-suffix)))))
(if was-at-max (goto-char (point-max))) (when was-at-max
(goto-char (point-max)))
(setq lyskom-current-prompt prompt) (setq lyskom-current-prompt prompt)
(setq lyskom-current-prompt-args prompt-args) (setq lyskom-current-prompt-args prompt-args)
(setq lyskom-current-prompt-text prompt-text)))) (setq lyskom-current-prompt-text prompt-text))))
......
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