Commit bb6c0c2a authored by David Byers's avatar David Byers
Browse files

Bugfixar i macros.el, rättade strängar och tangentbindningar, ny hook i...

Bugfixar i macros.el, rättade strängar och tangentbindningar, ny hook i view-text.el, korrekt komplettering av strängar genom collate-tabell
parent cc90393c
Thu Aug 22 08:50:20 1996 David Byers <davby@sen2.ida.liu.se>
* startup.el (lyskom-clear-vars): Lade till lyskom-collate-table
som buffertlokal variabel i vntan p serveranrop fr att hmta
tabellen.
Wed Aug 21 09:52:47 1996 David Byers <davby@sen2.ida.liu.se>
* english-strings.el, swedish-strings.el
(lyskom-missing-commands): Ny variabel
(lyskom-mode-map): Bind b till lyskom-previous-prefix. Bind bl
till kom-previous-lyskom.
* english-strings.el (lyskom-missing-strings): Ny konstant.
(lyskom-strings): Fixade felstavning av "report", lade till
prioritize-help, change-type-prompt, filter-which-text,
enter-conf, your-priorities och andra som saknades.
* completing-read.el (lyskom-complete-string-next-char): Anvnd
lyskom-unicase istf downcase.
(lyskom-completing-cache-completion): Dito.
(lyskom-completing-lookup-z-name): Dito.
(lyskom-completing-member): Dito.
* utilities.el (lyskom-collate-table): Ny variabel, tagen frn
lyskomd-ssen. (lyskom-unicase): Ny funktion.
(lyskom-unicase-char): Ny funktion.
Tue Aug 20 10:11:11 1996 David Byers <davby@sen2.ida.liu.se>
* macros.el (match-string): Ny kompatibilitetsdefinition.
(map-keymap): Definiera med lyskom-provide-macro.
(lyskom-provide-function): Definiera med lyskom-provide.
(lyskom-provide-subst): Nytt makro, definierat med lyskom-provide.
(facep): Definiera med lyskom-provide-function. (internal-facep):
Definiera med lyskom-provide-subst. (lyskom-provide): Ny funktion.
* startup.el (lyskom): Lade in ;;;###autoload fre.
Mon Aug 19 15:10:50 1996 David Byers <davby@sen2.ida.liu.se>
* vars.el.in (lyskom-view-text-hook): Ny variabel.
* view-text.el (lyskom-view-text): Anropa lyskom-view-text-hook
* macros.el (lyskom-provide-macro): Nytt makro
(lyskom-provide-function): Nytt makro
(byte-code-function-p): Definiera med lyskom-provide-macro
(save-selected-window): Definiera med lyskom-provide-macro
Thu Aug 15 21:15:10 1996 David Kgedal <davidk@lysator.liu.se>
* Version 0.43.2 slppt.
* startup.el (lyskom): teranvnd inte levande sessioner.
Thu Aug 15 10:08:21 1996 David Byers <davby@sen2.ida.liu.se>
* completing-read.el (lyskom-complete-string): Kanske lite
smartare expansion av strngar (mindre onskade SPC i slutet av
expansionen.) Backa markren till position fr frsta mismatch.
Expandera strngar med "Foofum X, Foobar (b) X" rtt.
Wed Aug 14 17:03:17 1996 David Kgedal <davidk@lysator.liu.se>
* Version 0.43.1 slppt.
......
......@@ -66,7 +66,7 @@
(listify-vector (blocking-do 'who-is-on)))))
(defun lyskom-completing-cache-completion (string data)
(let* ((downs (downcase string))
(let* ((downs (lyskom-unicase string))
(tmp (assoc downs lyskom-completing-lookup-name-cache)))
(if (null tmp)
(setq lyskom-completing-lookup-name-cache
......@@ -76,7 +76,7 @@
(defun lyskom-completing-lookup-z-name (string want-conf want-pers)
"Look up STRING as a name. Same as \(blocking-do 'lookup-z-name ...\)
but first checks a cache."
(let* ((downs (downcase string))
(let* ((downs (lyskom-unicase string))
(tmp (assoc downs lyskom-completing-lookup-name-cache)))
(if tmp
(cdr tmp)
......@@ -445,7 +445,7 @@ function work as a name-to-conf-stat translator."
"Check case-insensitively if STRING is a member of LIST"
(let (result)
(while (and list (not result))
(if (string= (downcase string) (downcase (car list)))
(if (string= (lyskom-unicase string) (lyskom-unicase (car list)))
(setq result list)
(setq list (cdr list))))
result))
......@@ -472,6 +472,22 @@ function work as a name-to-conf-stat translator."
(null x-list)))))
;(defun lyskom-complete-show-data-list (state data)
; (save-excursion
; (pop-to-buffer (get-buffer-create "*kom*-complete"))
; (erase-buffer)
; (while data
; (insert
; (format "%s\n" (substring (aref (car data) 2)
; (aref (car data) 0)
; (aref (car data) 1))))
; (setq data (cdr data)))
; (insert (format "%S %S: %S" (symbol-value current-state)
; (elt state 0)
; (elt state 1)))
; (sit-for 1)))
(defun lyskom-complete-string (string-list)
"Find the longest common prefix of all strings in STRING-LIST according to
the LysKOM rules of string matching."
......@@ -484,11 +500,14 @@ the LysKOM rules of string matching."
(done nil)
(next-char-start nil)
(paren-depth 0)
(have-here nil)
(last-event-worth-noting nil)
(data-list (lyskom-complete-string-munge-input string-list))
(next-char-state (vector nil nil)))
(while (not done)
(lyskom-complete-string-next-char next-char-state data-list)
; (lyskom-complete-show-data-list next-char-state data-list)
(cond
;;
......@@ -497,6 +516,7 @@ the LysKOM rules of string matching."
;;
((eq (aref next-char-state 0) 'match)
(setq last-event-worth-noting 'match)
(if (and (eq (aref next-char-state 1) ?\ )
(or (eq (symbol-value current-state) 'start-of-word)
(eq (symbol-value current-state) 'start-of-string)))
......@@ -517,6 +537,7 @@ the LysKOM rules of string matching."
;;
((eq (aref next-char-state 0) 'open-paren-match)
(setq last-event-worth-noting 'match)
(if (zerop paren-depth)
(progn
(setq current-accumulator 'tmp-accumulator)
......@@ -537,6 +558,7 @@ the LysKOM rules of string matching."
;;
((eq (aref next-char-state 0) 'close-paren-match)
(setq last-event-worth-noting 'match)
(lyskom-complete-string-accumulate current-accumulator
(aref next-char-state 1))
(if (> paren-depth 0)
......@@ -559,6 +581,7 @@ the LysKOM rules of string matching."
(or (eq (aref next-char-state 0) 'mismatch)
(eq (aref next-char-state 0) 'space-mismatch)
(eq (aref next-char-state 0) 'open-paren-mismatch)))
(setq last-event-worth-noting 'mismatch)
(setq tmp-accumulator nil)
(setq tmp-state nil)
(setq current-state 'main-state)
......@@ -572,7 +595,9 @@ the LysKOM rules of string matching."
;;
((and (eq (aref next-char-state 0) 'space-mismatch)
(eq (symbol-value current-state) 'start-of-string))
(or (eq (symbol-value current-state) 'start-of-string)
(eq (symbol-value current-state) 'start-of-word)))
(setq last-event-worth-noting 'nil)
(lyskom-complete-string-skip-whitespace data-list))
;;
......@@ -587,6 +612,12 @@ the LysKOM rules of string matching."
(eq (symbol-value current-state) 'start-of-string))
(setq done t)
(progn
(if (not have-here)
(progn
(lyskom-complete-string-accumulate current-accumulator
'HERE)
(setq have-here t)))
(setq last-event-worth-noting 'mismatch)
(lyskom-complete-string-advance-to-end-of-word data-list)
(set current-state 'in-a-word))))
......@@ -595,6 +626,7 @@ the LysKOM rules of string matching."
;;
((eq (aref next-char-state 0) 'open-paren-mismatch)
(setq last-event-worth-noting 'mismatch)
(lyskom-complete-string-skip-parens data-list))
......@@ -616,10 +648,24 @@ the LysKOM rules of string matching."
;; string out of it.
;;
(if (eq last-event-worth-noting 'mismatch)
(while (and main-accumulator
(eq (car main-accumulator) ?\ ))
(setq main-accumulator (cdr main-accumulator))))
(setq main-accumulator (nreverse main-accumulator))
(if (memq 'HERE main-accumulator)
(let ((backup (length (memq 'HERE main-accumulator))))
(setq unread-command-events
(append (cons ? (make-list (1- backup) 2))
unread-command-events))
(setq main-accumulator (delq 'HERE main-accumulator))))
(let ((tmp (make-string (length main-accumulator) 0))
(index 0))
(lyskom-traverse
el (nreverse main-accumulator)
el main-accumulator
(aset tmp index el)
(setq index (1+ index)))
tmp)))
......@@ -731,8 +777,8 @@ the LysKOM rules of string matching."
(progn
(setq xchar (aref (aref x 2)
(aref x 0)))
(setq char (downcase xchar)))
(eq char (downcase (aref (aref x 2)
(setq char (lyskom-unicase-char xchar)))
(eq char (lyskom-unicase-char (aref (aref x 2)
(aref x 0)))))))))
data-list)
......
......@@ -107,6 +107,9 @@ Help: \\[describe-mode] ---")
(defvar lyskom-swascii-header-subject nil
"The swascii version of lyskom-header-subject.")
(defconst lyskom-missing-strings
'(cgdag sixjune holdnose))
(defconst lyskom-strings
'(
; From vars.el:
......@@ -391,6 +394,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(conf-for-status . "Get status of which conference: ")
(no-such-conf . "The conference doesn't exist.\n")
(status-record . "Status of conference %#1M (%#2m) %#3s\n\n")
(change-type-prompt . "Change conference type for %#1M (%#2m) %#3s\n")
(Mailbox . "Mailbox")
(Protected . "Protected")
(no-comments . "No comments")
......@@ -501,8 +505,8 @@ The message you were sending to %#1M was:
(summary-line . "%=-8#1n%#2s%4#3d %[%#4@%#5:P%] %[%#6@%#7r%]\n")
; Only people fixing bugs or recieving bugg-reports should change these:
(buggrepport-compilestart . "Creating bug report...")
(buggrepport-compileend . "Creating bug report...done")
(buggreport-compilestart . "Creating bug report...")
(buggreport-compileend . "Creating bug report...done")
(buggreport-description . "This is what I was doing:
\(Fill in your comments below\)\n================\n\n
================
......@@ -723,6 +727,11 @@ Group message to %#3M\nfrom %#2P (%#4s):
(cannot-get-membership . "Cannot retrieve your membership list.")
(cannot-get-pers-stat . "Cannot retrieve your personal status.")
(prioritize-help .
"u,n Move conference, SPC select, p prioritize selection, q quit, C-h m help")
(your-priorities . " Priority Conference
----------------------------------------------------------------------------
")
(your-membship . "Your memberships:
Prio Conf# Conference\n")
(prio-row . " %5#1d%5#2d %#3M\n")
......@@ -769,6 +778,7 @@ You should set it to a better value.\n")
(all-conf-unread-s . "You have nothing unread. ")
(one-unread . "%#1M - one unread article\n")
(several-unread . "%#1M - %#2d unread articles\n")
(enter-conf . "%#1M\n")
(save-on-file-q . "Save which article in file: (%#1s) ")
(wait-for-prompt . "Wait for the prompt.")
......@@ -846,7 +856,7 @@ Error message: %#1s**************************************************")
(filter-action . "Filter how: ")
(filter-in-conf . "In which conference (all): ")
(filter-subject . "Filter which subject: ")
(filter-text . "Filter articles containing: ")
(filter-which-text . "Filter articles containing: ")
(filter-author . "Filter which author: ")
(permanent . "(permanent)")
(temporary . "(temporary)")
......@@ -999,6 +1009,7 @@ On since %#8s%#9s")
(kom-review-next "Review next")
(kom-find-root "Review original (article)")
(kom-review-by-to "Review last")
(kom-review-first "Review first")
(kom-review-all "Review all")
(kom-view-commented-text "Review (the) commented (article)")
(kom-view-previous-commented-text
......@@ -1122,6 +1133,8 @@ On since %#8s%#9s")
Cf. paragraph-start.")
(defconst lyskom-missing-bindings nil)
(if lyskom-mode-map
nil
(setq lyskom-mode-map (make-keymap))
......@@ -1132,12 +1145,14 @@ Cf. paragraph-start.")
(define-prefix-command 'lyskom-list-prefix)
(define-prefix-command 'lyskom-filter-get-prefix)
(define-prefix-command 'lyskom-S-prefix)
(define-prefix-command 'lyskom-previous-prefix)
(define-key lyskom-mode-map "A" 'lyskom-change-prefix)
(define-key lyskom-mode-map "r" 'lyskom-review-prefix)
(define-key lyskom-mode-map "f" 'lyskom-filter-get-prefix)
(define-key lyskom-mode-map "n" 'lyskom-next-prefix)
(define-key lyskom-mode-map "l" 'lyskom-list-prefix)
(define-key lyskom-mode-map "s" 'lyskom-S-prefix)
(define-key lyskom-mode-map "b" 'lyskom-previous-prefix)
(define-key lyskom-mode-map [mouse-2] 'kom-mouse-2)
(define-key lyskom-mode-map [down-mouse-3] 'kom-mouse-3)
......@@ -1186,8 +1201,7 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "nc" 'kom-go-to-next-conf)
(define-key lyskom-mode-map "nl" 'kom-next-kom)
(define-key lyskom-mode-map "nu" 'kom-next-unread-kom)
;; What key should this be on?
;;(define-key lyskom-mode-map "fl" 'kom-previous-kom)
(define-key lyskom-mode-map "bl" 'kom-previous-kom)
(define-key lyskom-mode-map "q" 'kom-quit)
(define-key lyskom-mode-map "z" 'kom-bury)
(define-key lyskom-mode-map "R" 'kom-recover)
......@@ -1197,7 +1211,6 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "fs" 'kom-filter-subject)
(define-key lyskom-mode-map "fa" 'kom-filter-author)
(define-key lyskom-mode-map "fc" 'kom-filter-text)
(define-key lyskom-mode-map "w" 'kom-who-is-on)
(define-key lyskom-mode-map "I" 'kom-who-am-i)
(define-key lyskom-mode-map "W" 'kom-busy-wait)
......
......@@ -37,6 +37,28 @@
(defmacro lyskom-provide (definer name rest)
(` (progn (eval-when-compile
(if (not (fboundp (quote (, name))))
(message "Compatibility %S for %S"
(quote (, definer))
(quote (, name)))))
(eval-and-compile
(if (not (fboundp (quote (, name))))
((, definer) (, name) (,@ rest)))))))
(defmacro lyskom-provide-macro (name &rest rest)
(` (lyskom-provide defmacro (, name) (, rest))))
(defmacro lyskom-provide-function (name &rest rest)
(` (lyskom-provide defun (, name) (, rest))))
(defmacro lyskom-provide-subst (name &rest rest)
(` (lyskom-provide defsubst (, name) (, rest))))
;;; lyskom-traverse - traverse a sequence.
(defmacro lyskom-traverse (atom sequence &rest body)
......@@ -214,31 +236,29 @@ All the forms in BIND-LIST are evaluated before and symbols are bound."
;;; too many compiler warnings.
;;;
(if (not (fboundp 'byte-code-function-p))
(defmacro byte-code-function-p (obj) (` (compiled-function-p (, obj)))))
(if (not (fboundp 'facep))
(progn
(defsubst internal-facep (x)
(and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face)))
(defun facep (x)
"Return t if X is a face name or an internal face vector."
(and (or (and (fboundp 'internal-facep)
(internal-facep x))
(and (symbolp x)
(boundp 'global-face-data)
(assq x global-face-data)))
t))))
(if (not (fboundp 'save-selected-window))
(defmacro save-selected-window (&rest body)
"Execute BODY, then select the window that was selected before BODY."
(list 'let
'((save-selected-window-window (selected-window)))
(list 'unwind-protect
(cons 'progn body)
(list 'select-window 'save-selected-window-window)))))
(lyskom-provide-macro byte-code-function-p (obj)
(` (compiled-function-p (, obj))))
(lyskom-provide-subst internal-facep (x)
(and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face)))
(lyskom-provide-function facep (x)
"Return t if X is a face name or an internal face vector."
(and (or (and (fboundp 'internal-facep)
(internal-facep x))
(and (symbolp x)
(boundp 'global-face-data)
(assq x global-face-data)))
t))
(lyskom-provide-macro save-selected-window (&rest body)
"Execute BODY, then select the window that was selected before BODY."
(list 'let
'((save-selected-window-window (selected-window)))
(list 'unwind-protect
(cons 'progn body)
(list 'select-window 'save-selected-window-window))))
(if (not (fboundp 'frame-width))
(fset 'frame-width 'screen-width))
......@@ -249,23 +269,36 @@ All the forms in BIND-LIST are evaluated before and symbols are bound."
;;; except that the sort-first argument is ignored.
;;;
(if (not (fboundp 'map-keymap))
(defun map-keymap (fn keymap &optional sort-first)
(let ((lis nil)
(r 0))
(cond ((vectorp keymap)
(while (< r (length keymap))
(if (aref keymap r)
(funcall fn r (aref keymap r)))
(setq r (1+ r))))
(t (mapcar (function
(lambda (x)
(funcall fn (car x) (cdr x))))
(cdr keymap)))))))
(lyskom-provide-function map-keymap (fn keymap &optional sort-first)
(let ((lis nil)
(r 0))
(cond ((vectorp keymap)
(while (< r (length keymap))
(if (aref keymap r)
(funcall fn r (aref keymap r)))
(setq r (1+ r))))
(t (mapcar (function
(lambda (x)
(funcall fn (car x) (cdr x))))
(cdr keymap))))))
(lyskom-provide-function match-string (num &optional string)
"Return string of text matched by last search.
NUM specifies which parenthesized expression in the last regexp.
Value is nil if NUMth pair didn't match, or there were less than NUM pairs.
Zero means the entire text matched by the whole regexp or whole string.
STRING should be given if the last search was by `string-match' on STRING."
(if (match-beginning num)
(if string
(substring string (match-beginning num) (match-end num))
(buffer-substring (match-beginning num) (match-end num)))))
;;; Local Variables:
;;; eval: (put 'lyskom-traverse 'lisp-indent-hook 2)
;;; eval: (put 'lyskom-provide-macro 'lisp-indent-hook 2)
;;; eval: (put 'lyskom-provide-function 'lisp-indent-hook 2)
;;; eval: (put 'lyskom-provide-subst 'lisp-indent-hook 2)
;;; end:
......
......@@ -42,6 +42,7 @@
;;; Start kom.
;;;###autoload
(defun lyskom (&optional host username password)
"Start a LysKOM session.
Optional arguments: HOST, USERNAME and PASSWORD.
......@@ -668,6 +669,7 @@ to see, set of call."
(make-local-variable 'lyskom-who-info-buffer)
(make-local-variable 'lyskom-who-info-buffer-is-on)
(make-local-variable 'lyskom-who-info-cache)
(make-local-variable 'lyskom-collate-table)
(make-local-variable 'mode-line-conf-name)
(setq lyskom-proc proc)
(setq lyskom-pers-no pers-no)
......@@ -680,6 +682,7 @@ to see, set of call."
(setq lyskom-server-name server-name)
(setq lyskom-do-when-done (cons kom-do-when-done kom-do-when-done))
(setq lyskom-output-queues (make-vector 10 nil))
(setq lyskom-collate-table lyskom-default-collate-table)
(let ((i 0))
(while (< i 10)
(aset lyskom-output-queues i (lyskom-queue-create))
......
......@@ -112,6 +112,8 @@ Annat se \\[describe-mode] ---")
(defvar lyskom-swascii-header-subject nil
"The swascii version of lyskom-header-subject.")
(defconst lyskom-missing-strings '())
(defconst lyskom-strings
'(
; From vars.el:
......@@ -1158,6 +1160,8 @@ Uppkopplad sedan %#8s%#9s")
Cf. paragraph-start.")
(defconst lyskom-missing-bindings '(lyskom-previous-prefix))
(if lyskom-mode-map
nil
(setq lyskom-mode-map (make-keymap))
......
No preview for this file type
......@@ -194,6 +194,13 @@ tree.
This variable is stored in the LysKOM server.")
(defvar lyskom-view-text-hook nil
"*Hook that is called before a text is shown. When the hooks is
called, text is bound to the text mass of the text and text-stat to
the text-stat of the text to be shown.
This variable is not stored in the LysKOM server.")
(defvar lyskom-send-message-hook '(lyskom-send-message-trim-newlines)
"*Hook that is called before a personal, group or common message is sent.
......@@ -1188,6 +1195,9 @@ an unknown conference.")
(defvar lyskom-apo-timeout-ms nil
"Microseconds timeout for accept-process-output")
(defvar lyskom-collate-table nil
"Table mapping characters to equivalent characters.")
(defvar lyskom-dont-read-user-area nil
"If non-nil the user area will not be read on login.")
......
......@@ -82,6 +82,7 @@ Note that this function must not be called asynchronously."
(if (and text-stat
text)
(progn
(run-hooks 'lyskom-view-text-hook)
(setq start (point-max))
(lyskom-format-insert "%#1n "
text-stat)
......
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