Commit 34857c9c authored by David Kågedal's avatar David Kågedal
Browse files

* commands2.el (lyskom-update-lyskom-buffer-list): Kommenterade

bort.
(kom-next-kom, kom-previous-kom): Skrev om.
parent ac28b759
...@@ -1327,64 +1327,91 @@ membership info." ...@@ -1327,64 +1327,91 @@ membership info."
(processp lyskom-proc) (processp lyskom-proc)
(memq (process-status lyskom-proc) '(run open)))))) (memq (process-status lyskom-proc) '(run open))))))
(defun lyskom-update-lyskom-buffer-list () ;;;(defun lyskom-update-lyskom-buffer-list ()
(mapcar (function ;;; (mapcar (function
(lambda (buf) ;;; (lambda (buf)
(if (and (lyskom-buffer-p buf) ;;; (if (and (lyskom-buffer-p buf)
(not (memq buf lyskom-buffer-list))) ;;; (not (memq buf lyskom-buffer-list)))
;; This is a LysKOM buffer that we haven't seen yet -- ;;; ;; This is a LysKOM buffer that we haven't seen yet --
;; If it is the current buffer, add it at the start ;;; ;; If it is the current buffer, add it at the start
;; of lyskom-buffer-list, otherwise add it to the end ;;; ;; of lyskom-buffer-list, otherwise add it to the end
(if (eq buf (current-buffer)) ;;; (if (eq buf (current-buffer))
(setq lyskom-buffer-list (cons buf ;;; (setq lyskom-buffer-list (cons buf
lyskom-buffer-list)) ;;; lyskom-buffer-list))
(setq lyskom-buffer-list ;;; (setq lyskom-buffer-list
(nconc lyskom-buffer-list (list buf))))))) ;;; (nconc lyskom-buffer-list (list buf)))))))
(buffer-list)) ;;; (buffer-list))
(mapcar (function ;;; (mapcar (function
(lambda (buf) ;;; (lambda (buf)
(if buf ;;; (if buf
(setq lyskom-buffer-list ;;; (setq lyskom-buffer-list
(delete buf lyskom-buffer-list))))) ;;; (delete buf lyskom-buffer-list)))))
(mapcar (function ;;; (mapcar (function
(lambda (buf) ;;; (lambda (buf)
(if (lyskom-buffer-p buf) nil buf))) ;;; (if (lyskom-buffer-p buf) nil buf)))
lyskom-buffer-list))) ;;; lyskom-buffer-list)))
(defun kom-next-kom () (defun kom-next-kom ()
"Pop up the next lyskom-session." "Pop up the next lyskom-session."
(interactive) (interactive)
(lyskom-tell-internat 'kom-tell-next-lyskom) (lyskom-tell-internat 'kom-tell-next-lyskom)
(lyskom-update-lyskom-buffer-list)
;; Now we are ready to select the next LysKOM buffer
(if lyskom-buffer-list (if lyskom-buffer-list
(progn (progn
;;(kom-bury) (if (lyskom-buffer-p (car lyskom-buffer-list))
(setq lyskom-buffer-list (nconc (cdr lyskom-buffer-list) ;; If there is an "active" lyskom buffer, send it to the
(list (car lyskom-buffer-list)))) ;; back of the list.
(switch-to-buffer (car lyskom-buffer-list))) (progn
(error "No active LysKOM buffers"))) ;; If the "active" lyskom buffer is the current buffer,
;; and kom-bury-buffers is non-nil, bury it.
(if (and kom-bury-buffers
(eq (car lyskom-buffer-list)
(current-buffer)))
(kom-bury))
(setq lyskom-buffer-list
(nconc (cdr lyskom-buffer-list)
(list (car lyskom-buffer-list)))))
;; The "active" lyskom buffer is dead, so we remove it from
;; the list.
(setq lyskom-buffer-list (cdr lyskom-buffer-list)))
;; Don't switch to dead sessions.
(if (lyskom-buffer-p (car lyskom-buffer-list))
(switch-to-buffer (car lyskom-buffer-list))
(kom-next-kom)))
(error "No active LysKOM buffers"))))
(defun kom-previous-kom () (defun kom-previous-kom ()
"Pop up the previous lyskom-session." "Pop up the previous lyskom-session."
(interactive) (interactive)
(lyskom-tell-internat 'kom-tell-next-lyskom) (lyskom-tell-internat 'kom-tell-next-lyskom)
(lyskom-update-lyskom-buffer-list) (if (> (length lyskom-buffer-list) 1)
;; Now we are ready to select the previous LysKOM buffer
(if lyskom-buffer-list
(let (lastbuf (let (lastbuf
(last-but-one lyskom-buffer-list)) (last-but-one lyskom-buffer-list))
;;(kom-bury)
(while (cdr (cdr last-but-one)) (while (cdr (cdr last-but-one))
(setq last-but-one (cdr last-but-one))) (setq last-but-one (cdr last-but-one)))
(if (setq lastbuf (car (cdr last-but-one))) (setq lastbuf (car (cdr last-but-one)))
(if (lyskom-buffer-p (car lyskom-buffer-list))
;; If there is an "active" lyskom buffer, send it to the
;; back of the list.
(progn (progn
;; If the "active" lyskom buffer is the current buffer,
;; and kom-bury-buffers is non-nil, bury it.
(if (and kom-bury-buffers
(eq (car lyskom-buffer-list)
(current-buffer)))
(kom-bury))
(setq lyskom-buffer-list (cons lastbuf lyskom-buffer-list)) (setq lyskom-buffer-list (cons lastbuf lyskom-buffer-list))
(rplacd last-but-one nil) (rplacd last-but-one nil))
(switch-to-buffer lastbuf)))) ;; The "active" lyskom buffer is dead, so we remove it from
(error "No active LysKOM buffers"))) ;; the list.
(rplacd last-but-one nil))
(if (lyskom-buffer-p (car last-but-one))
(switch-to-buffer lastbuf)
(kom-previous-kom)))
(if (null lyskom-buffer-list)
(error "No active LysKOM buffers"))))
(defun kom-next-unread-kom () (defun kom-next-unread-kom ()
......
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