Commit 933e1c35 authored by David Byers's avatar David Byers

Fix bug 1620

Generalized support for lists like kom-highlight-conferences
parent d2e3c971
2007-06-24 <David Byers@GULAG>
Fix bug 1620:
* commands2.el (lyskom-send-message): Applicerade patch frn Per
Jonsson.
2007-06-13 <David Byers@GULAG>
Generalized support for lists like kom-highlight-conferences:
* utilities.el (lyskom-indirect-assq): New function.
(lyskom-indirect-assq-2): Utility function.
2007-06-12 <David Byers@GULAG>
Fix bug 1619:
......
......@@ -657,7 +657,9 @@ send. If DONTSHOW is non-nil, don't display the sent message."
lyskom-default-async-dashed-lines-face)))
(when kom-async-highlight-text-body
`(face ,(or kom-async-text-body-face
lyskom-default-async-text-body-face))))
lyskom-default-async-text-body-face)))
(let ((kom-print-relative-dates nil))
(lyskom-format-time 'date-and-time)))
lyskom-pers-no
kom-filter-outgoing-messages))
(lyskom-format-insert-before-prompt
......
......@@ -757,14 +757,14 @@ Read all about it at http://www.lysator.liu.se/history/")
(message-prompt . "Message%#1?z%[%]%[ (till alla inloggade)%]: ")
(message-sent-to-user . "\
%[%#3$================================================================
%]%[%#4$Your message for %#2M:
%]%[%#4$Your message for %#2M (%#5s):
%#1t
%]%[%#3$----------------------------------------------------------------
%]")
(message-sent-to-all . "\
%[%#3$================================================================
%]%[%#4$Your public message
%]%[%#4$Your public message (%#5s):
%#1t
%]%[%#3$----------------------------------------------------------------
......@@ -772,7 +772,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(message-sent-to-user-long . "\
%[%#3$\
===============================================================================
%]%[%#4$Your message for %#2M:
%]%[%#4$Your message for %#2M (%#5s):
%#1t
%]%[%#3$\
......@@ -781,7 +781,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(message-sent-to-all-long . "\
%[%#3$\
===============================================================================
%]%[%#4$Your public message
%]%[%#4$Your public message (%#5s):
%#1t
%]%[%#3$\
......
......@@ -770,7 +770,7 @@ i svensk datorhistoria. L
%[%#3$\
================================================================
%]%[%#4$\
Ditt meddelande till %#2M:
Ditt meddelande till %#2M (%#5s):
%#1t
%]%[%#3$\
......@@ -780,7 +780,7 @@ Ditt meddelande till %#2M:
%[%#3$\
================================================================
%]%[%#4$\
Ditt alarmmeddelande ld:
Ditt alarmmeddelande ld (%#5s):
%#1t
%]%[%#3$\
......@@ -790,7 +790,7 @@ Ditt alarmmeddelande l
%[%#3$\
===============================================================================
%]%[%#4$\
Ditt meddelande till %#2M:
Ditt meddelande till %#2M (%#5s):
%#1t
%]%[%#3$\
......@@ -800,7 +800,7 @@ Ditt meddelande till %#2M:
%[%#3$\
===============================================================================
%]%[%#4$\
Ditt alarmmeddelande ld:
Ditt alarmmeddelande ld (%#5s):
%#1t
%]%[%#3$\
......
......@@ -187,6 +187,62 @@ If BEFORE is not in the list, then insert EL at the end of the list."
(setq lyskom-max-int (lyskom-maxint))
(defun lyskom-indirect-assq (key assoc-list)
"Return the value of KEY in ASSOC-LIST.
An indirect assoc list is a kind of assoc list that can contain
references to other lists. This function is intended to work with
numbers only since symbols and lists have special meanings as keys.
Matching is done as follows. If an element in ASSOC-LIST is a cons
and its car is a:
symbol bound to a list Recursively test the list, setting the
default return value to the cdr of the
element.
symbol with value eq KEY Return cdr of the element.
function Call the function with KEY as its only arg.
Return the cdr of the element if the function
returns non-nil.
list Return the cdr of the element if KEY is
memq the list.
t If they key isn't found anywhere, return the
cdr of this element.
other atom Return the cdr of the element if KEY is eq
the car of the element.
If an element in ASSOC-LIST is not a cons, but is eq KEY, return
the default return value (which defaults to t, but can be changed
when recursing due to bound symbols being used as keys."
(catch 'lyskom-indirect-assq-return
(let ((memo-list (cons nil nil)))
(lyskom-indirect-assq-2 key assoc-list memo-list t)
(car memo-list))))
(defun lyskom-indirect-assq-2 (key assoc-list &optional memo-list default-return)
"Internal function to implement lyskom-indirect-assoc."
(unless (memq assoc-list memo-list)
(setcdr memo-list (cons assoc-list (cdr memo-list)))
(lyskom-traverse el assoc-list
(cond ((atom el) (when (eq el key) (throw 'lyskom-indirect-assq-return default-return)))
((eq t (car el)) (setcar memo-list (cdr el)))
((functionp (car el))
(when (funcall (car el) key)
(throw 'lyskom-indirect-assq-return (cdr el))))
((and (symbolp (car el)) (boundp (car el)))
(cond ((listp (symbol-value (car el)))
(lyskom-indirect-assq-2 key (symbol-value (car el)) memo-list (cdr el)))
((eq (symbol-value (car el)) key)
(throw 'lyskom-indirect-assq-return (cdr el)))))
((listp (car el))
(lyskom-indirect-assq-2 key (car el) memo-list (cdr el)))
((atom (car el)) (when (eq (car el) key) (throw 'lyskom-indirect-assq-return (cdr el))))))))
(defun lyskom-try-require (feature &optional message &rest args)
"Load the feature FEATURE using require.
......
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