Commit 3c5c4b07 authored by David Byers's avatar David Byers
Browse files

Add unread indicator in the title bar

parent c7a48955
2000-05-26 David Byers <davby@ida.liu.se> 2000-05-26 David Byers <davby@ida.liu.se>
Unread marker in title bar
* vars.el.in (kom-show-unread-in-frame-title): New variable.
* lyskom-rest.el (lyskom-is-loaded): Set
lyskom-unread-title-format, frame-title-format and
frame-icon-title-format.
(lyskom-unread-title-format): New variable.
* buffers.el (lyskom-traverse-buffer-hierarchy): New function.
(lyskom-remove-unread-buffer): Clear flags in the buffer saying
that the buffer has unreads.
(lyskom-add-unread-buffer): Set flags in the buffer saying that
the buffer has unreads.
* commands1.el (lyskom-quit): Use lyskom-remove-unread-buffer.
Bind lyskom-executing-command in interactive forms
* command.el (lyskom-fix-interactive-decl): New function puts a * command.el (lyskom-fix-interactive-decl): New function puts a
let around evaluated arguments to interactive that binds let around evaluated arguments to interactive that binds
lyskom-executing-command to the current command. lyskom-executing-command to the current command.
......
...@@ -8,50 +8,49 @@ Att g ...@@ -8,50 +8,49 @@ Att g
Använd lyskom-read-text-no-prefix arg i alla funktioner där det är Använd lyskom-read-text-no-prefix arg i alla funktioner där det är
meningsfullt. Följande är relevanta: meningsfullt. Följande är relevanta:
Radera inlägg Kommando Default Prompt
Återse inlägg ------------------------------------------------------
Återse omodifierat Radera inlägg ? Alltid
Återse urinlägget Återse inlägg Inget Ja
Återse det kommenterade Återse omodifierat SL Nej
Återse det föregående kommenterade Återse urinlägget SL Nej
Kommentera inlägget Återse det kommenterade SL Nej
Kommentera föregående inlägg Återse det föregående kommen NSL Nej
Fotnot till inlägg Kommentera inlägget SL Nej
Personligt svar Kommentera föregående inlägg NSL Nej
Personligt svar på föregående inlägg Fotnot till inlägg SS ?
Markera (inlägg) Personligt svar SL Nej
Avmarkera (inlägg) Personligt svar på föregåend NSL Nej
Addera mottagare Markera (inlägg) SL ?
Addera extra kopiemottagare Avmarkera (inlägg) ? ?
Addera för kännedom Addera mottagare SL ?
Subtrahera mottagare Addera extra kopiemottagare SL ?
Flytta inlägg Addera för kännedom SL ?
Addera kommentar Subtrahera mottagare SL ?
Subtrahera kommentar Flytta inlägg SL Ja
Arkivera inlägg (till fil) Addera kommentar SL ?
Spara inläggstext (på fil) Subtrahera kommentar SL ?
Sätt loginmeddelande Arkivera inlägg (till fil) SL ?
Kort replik Spara inläggstext (på fil) SL ?
Hålla med Sätt loginmeddelande SS Ja
Addera FAQ Kort replik SL Nej
Addera fotnot Hålla med SL Nej
Subtrahera fotnot Addera FAQ SS Ja
Förhindra kommentarer Addera fotnot SS ?
Begär personligt svar Subtrahera fotnot SS ?
Begär läsbekräftelse Förhindra kommentarer SS ?
Återse brevhuvud Begär personligt svar SS ?
Begär läsbekräftelse SS ?
Återse brevhuvud SL Ja
------------------------------------------------------
SL Senast lästa
NSL Näst senast lästa
SS Senast skrivna/eget läst
Bestäm vettig default och om kommandot skall fråga efter nummer eller Bestäm vettig default och om kommandot skall fråga efter nummer eller
bara anta default om man inte ger prefixargument. bara anta default om man inte ger prefixargument.
Gör så att lyskom-read-text-no-prefix-arg vet vilket kommando som
håller på köras. Ge det ett extra argument för kommandot och fixa
def-kom-command så att den patchar interactive-specen om den
innehåller ett anrop till lyskom-read-text-no-arg.
Det vore trevligt om "Arkivera inlägg (till fil)" fanns i kontextmenyn 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 för inläggsnummer också, samt om man kunde ställa in en defaultpath
till funktionen, helst också per KOM. till funktionen, helst också per KOM.
......
...@@ -127,6 +127,21 @@ a child of some buffer, reparent it." ...@@ -127,6 +127,21 @@ a child of some buffer, reparent it."
(setq buffer buffer-parent)) (setq buffer buffer-parent))
buffer)) buffer))
(defun lyskom-traverse-buffer-hierarchy (function buffer)
"Apply FUNCTION to each descendent of BUFFER. Results are discarded."
(let ((queue (list buffer))
(done nil)
(current nil))
(while queue
(setq current (car queue))
(setq queue (cdr queue))
(unless (or (memq current done)
(not (buffer-live-p buffer)))
(setq done (cons current done))
(setq queue (append queue (lyskom-get-buffer-children current)))
(funcall function current)))))
(defun lyskom-map-buffer-children (function buffer) (defun lyskom-map-buffer-children (function buffer)
"Apply FUNCTION to each child of BUFFER and make a list of the results." "Apply FUNCTION to each child of BUFFER and make a list of the results."
(cond ((null buffer) nil) (cond ((null buffer) nil)
...@@ -189,8 +204,11 @@ the children object" ...@@ -189,8 +204,11 @@ the children object"
"Remove all dead buffers from BUFFERS" "Remove all dead buffers from BUFFERS"
(let ((result nil)) (let ((result nil))
(while buffers (while buffers
(when (lyskom-buffer-p (car buffers)) (if (lyskom-buffer-p (car buffers))
(setq result (cons (car buffers) result))) (setq result (cons (car buffers) result))
(save-excursion (set-buffer (car buffers))
(setq lyskom-session-has-unread-letters nil)
(setq lyskom-session-has-unreads nil)))
(setq buffers (cdr buffers))) (setq buffers (cdr buffers)))
(nreverse result))) (nreverse result)))
...@@ -205,8 +223,18 @@ If BUFFER is not specified, assume the current buffer" ...@@ -205,8 +223,18 @@ If BUFFER is not specified, assume the current buffer"
(defun lyskom-remove-unread-buffer (buffer &optional letters-only) (defun lyskom-remove-unread-buffer (buffer &optional letters-only)
(unless letters-only (unless letters-only
(setq lyskom-sessions-with-unread (lyskom-traverse-buffer-hierarchy
(lambda (x)
(save-excursion (set-buffer x)
(setq lyskom-session-has-unreads nil)))
buffer)
(setq lyskom-sessions-with-unread
(delq buffer lyskom-sessions-with-unread))) (delq buffer lyskom-sessions-with-unread)))
(lyskom-traverse-buffer-hierarchy
(lambda (x)
(save-excursion (set-buffer x)
(setq lyskom-session-has-unread-letters nil)))
buffer)
(setq lyskom-sessions-with-unread-letters (setq lyskom-sessions-with-unread-letters
(delq buffer lyskom-sessions-with-unread-letters)) (delq buffer lyskom-sessions-with-unread-letters))
(lyskom-set-default 'lyskom-need-prompt-update t)) (lyskom-set-default 'lyskom-need-prompt-update t))
...@@ -214,10 +242,20 @@ If BUFFER is not specified, assume the current buffer" ...@@ -214,10 +242,20 @@ If BUFFER is not specified, assume the current buffer"
(defun lyskom-add-unread-buffer (buffer &optional letters) (defun lyskom-add-unread-buffer (buffer &optional letters)
(unless (memq buffer lyskom-sessions-with-unread) (unless (memq buffer lyskom-sessions-with-unread)
(lyskom-traverse-buffer-hierarchy
(lambda (x)
(save-excursion (set-buffer x)
(setq lyskom-session-has-unreads t)))
buffer)
(setq lyskom-sessions-with-unread (setq lyskom-sessions-with-unread
(cons buffer lyskom-sessions-with-unread))) (cons buffer lyskom-sessions-with-unread)))
(unless (or (null letters) (unless (or (null letters)
(memq buffer lyskom-sessions-with-unread-letters)) (memq buffer lyskom-sessions-with-unread-letters))
(lyskom-traverse-buffer-hierarchy
(lambda (x)
(save-excursion (set-buffer x)
(setq lyskom-session-has-unread-letters t)))
buffer)
(setq lyskom-sessions-with-unread-letters (setq lyskom-sessions-with-unread-letters
(cons buffer lyskom-sessions-with-unread-letters))) (cons buffer lyskom-sessions-with-unread-letters)))
(lyskom-set-default 'lyskom-need-prompt-update t)) (lyskom-set-default 'lyskom-need-prompt-update t))
......
...@@ -1071,10 +1071,7 @@ If optional argument is non-nil then dont ask for confirmation." ...@@ -1071,10 +1071,7 @@ If optional argument is non-nil then dont ask for confirmation."
"Quit a session. Kill process and buffer-local variables. "Quit a session. Kill process and buffer-local variables.
Don't ask for confirmation." Don't ask for confirmation."
(initiate-logout 'main nil) (initiate-logout 'main nil)
(setq lyskom-sessions-with-unread (lyskom-remove-unread-buffer lyskom-buffer)
(delq lyskom-buffer lyskom-sessions-with-unread))
(setq lyskom-sessions-with-unread-letters
(delq lyskom-buffer lyskom-sessions-with-unread-letters))
(set-process-sentinel lyskom-proc nil) (set-process-sentinel lyskom-proc nil)
(delete-process lyskom-proc) (delete-process lyskom-proc)
(lyskom-insert-string (lyskom-get-string-sol 'session-ended)) (lyskom-insert-string (lyskom-get-string-sol 'session-ended))
......
...@@ -973,6 +973,8 @@ Send a bug report.\n") ...@@ -973,6 +973,8 @@ Send a bug report.\n")
(mode-line-unread . " Unread ") (mode-line-unread . " Unread ")
(mode-line-letters . "letters ") (mode-line-letters . "letters ")
(frame-title-unread . "Unread")
(frame-title-letters . " letters")
(sessions-with-unreads . "Sessions with unread texts") (sessions-with-unreads . "Sessions with unread texts")
(unread-letters . "unread letters") (unread-letters . "unread letters")
......
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
;;; ;;;
(defvar lyskom-unread-mode-line nil) (defvar lyskom-unread-mode-line nil)
(defvar lyskom-unread-title-format nil)
;;; ================================================================ ;;; ================================================================
;;; Error reporting from a number of commands. ;;; Error reporting from a number of commands.
...@@ -3509,13 +3510,29 @@ One parameter - the prompt string." ...@@ -3509,13 +3510,29 @@ One parameter - the prompt string."
(append (list "" (cons extent 'lyskom-unread-mode-line)) (append (list "" (cons extent 'lyskom-unread-mode-line))
global-mode-string))) global-mode-string)))
(setq global-mode-string (setq global-mode-string
(append '("" lyskom-unread-mode-line) global-mode-string)))) (append '("" lyskom-unread-mode-line) global-mode-string))))
(setq frame-title-format (list ""
frame-title-format
'lyskom-unread-title-format))
(setq frame-icon-title-format (list ""
frame-icon-title-format
'lyskom-unread-title-format))
(setq lyskom-unread-mode-line (setq lyskom-unread-mode-line
(list (list 'lyskom-sessions-with-unread (list (list 'lyskom-sessions-with-unread
(lyskom-get-string 'mode-line-unread)) (lyskom-get-string 'mode-line-unread))
(list 'lyskom-sessions-with-unread-letters (list 'lyskom-sessions-with-unread-letters
(lyskom-get-string 'mode-line-letters)) (lyskom-get-string 'mode-line-letters))
" ")) " "))
(setq lyskom-unread-title-format
`(kom-show-unread-in-frame-title
(lyskom-session-has-unreads
(" ("
((lyskom-session-has-unreads ,(lyskom-get-string 'frame-title-unread))
(lyskom-session-has-unread-letters ,(lyskom-get-string 'frame-title-letters)))
")"))))
(add-hook 'kill-buffer-hook 'lyskom-remove-buffer-from-lists) (add-hook 'kill-buffer-hook 'lyskom-remove-buffer-from-lists)
......
...@@ -979,6 +979,8 @@ Skicka en bugrapport.\n") ...@@ -979,6 +979,8 @@ Skicka en bugrapport.\n")
(mode-line-unread . " Olsta ") (mode-line-unread . " Olsta ")
(mode-line-letters . "brev ") (mode-line-letters . "brev ")
(frame-title-unread . "Olsta")
(frame-title-letters . " brev")
(sessions-with-unreads . "Sessioner med olsta") (sessions-with-unreads . "Sessioner med olsta")
(unread-letters . "olsta brev") (unread-letters . "olsta brev")
......
...@@ -302,6 +302,11 @@ used." ...@@ -302,6 +302,11 @@ used."
entering a conference." entering a conference."
server) server)
(def-kom-var kom-show-unread-in-frame-title t
"*If non-nil, then show an unread indicator in the frame title of each
LysKOM session."
server)
(def-kom-var kom-presence-messages t (def-kom-var kom-presence-messages t
"*If non-nil, lyskom prints continuous info about what other people are doing. "*If non-nil, lyskom prints continuous info about what other people are doing.
Info is printed on the message line and never in the buffer. If minibuffer is Info is printed on the message line and never in the buffer. If minibuffer is
...@@ -1368,6 +1373,18 @@ This is not buffer-local.") ...@@ -1368,6 +1373,18 @@ This is not buffer-local.")
"List of lyskom-sessions with unread letters. "List of lyskom-sessions with unread letters.
This is not buffer-local.") This is not buffer-local.")
(def-kom-var lyskom-session-has-unread-letters nil
"Non-nil if this session has unread letters."
local
protected
inherited)
(def-kom-var lyskom-session-has-unreads nil
"Non-nil if this session has unread texts."
local
protected
inherited)
(def-kom-var lyskom-buffer nil (def-kom-var lyskom-buffer nil
"What is the lyskom-buffer we are connected to." "What is the lyskom-buffer we are connected to."
inherited inherited
......
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