Commit 6f1d9083 authored by David Byers's avatar David Byers
Browse files

Fixar till stavningskontrollen mm

parent e5d43a36
Fri Jul 11 09:17:28 1997 David Byers <davby@ida.liu.se>
* english-strings.el,swedish-strings.el (lyskom-custom-strings):
Lade till kom-ispell-dictionary-doc och kom-ispell-dictionary-tag.
* option-edit.el (lyskom-ispell-dictionary-widget): Ny funktion.
(lyskom-customize-buffer-format): Lade till kom-ispell-dictionary
(lyskom-custom-variables): Dito.
(lyskom-widget-functions): Lade till ispell-dictionary
* menus.el (lyskom-edit-menu-template): Lgg in kom-ispell-message
i edit-text-menyn.
* english-strings.el,swedish-strings.el (lyskom-menu): Text fr
kom-ispell-message.
* edit-text.el (lyskom-edit-send): Avsluta med
lyskom-edit-text-abort.
(kom-ispell-message): Nytt kommando.
(lyskom-ispell-text): Anvnd kom-ispell-message
* macros.el (lyskom-widget-wrapper): Nytt makro.
(widget-setup): Definiera med l-w-w
(widget-at): Dito
(widget-value): Dito
(widget-button-click): Dito
(widget-value-set): Dito
(widget-insert): Dito
(widget-create): Dito
(widget-get): Dito
(widget-put): Dito.
* vars.el.in (lyskom-text-buttons): Fixade liten regexpbug.
Thu Jul 10 10:16:35 1997 David Byers <davby@ida.liu.se>
* utilities.el (lyskom-set-face-scheme): Testa att console-type
......
......@@ -308,7 +308,7 @@ Commands:
(if (not (run-hook-with-args-until-failure
'lyskom-send-text-hook))
(signal 'quit nil))
(signal 'lyskom-edit-text-abort nil))
;;
;; Check that there is a subject
......@@ -398,8 +398,9 @@ kom-ispell-dictionary is the dictionary to use to check spelling."
(beginning-of-line)
(point))))
(let ((ispell-dictionary kom-ispell-dictionary)
(new-ispell (not (string= "svenska8" ispell-dictionary))))
(ignore ispell-dictionary)
(new-ispell (or (not (boundp 'ispell-dictionary))
(not (string= kom-ispell-dictionary
ispell-dictionary)))))
(if new-ispell
(ispell-kill-ispell t))
(prog1
......@@ -407,6 +408,96 @@ kom-ispell-dictionary is the dictionary to use to check spelling."
(if new-ispell
(ispell-kill-ispell t))))))
(defun lyskom-ispell-text ()
"Check spelling of the text body.
Put this in lyskom-send-text-hook"
(kom-ispell-message)
t)
(defun kom-ispell-message ()
"Check spelling of the text.
kom-ispell-dictionary is the dictionary to use to check spelling.
Based on ispell-message."
(interactive)
(let ((ispell-dictionary (or kom-ispell-dictionary ispell-dictionary))
(kill-ispell (or (not (boundp 'ispell-dictionary))
(not (string= kom-ispell-dictionary
ispell-dictionary))))
(result nil))
(when kill-ispell (ispell-kill-ispell t))
;; Checking code
(save-excursion
(goto-char (point-min))
(let* ((internal-messagep
(save-excursion
(re-search-forward
(concat "^"
(regexp-quote
(substitute-command-keys
(lyskom-get-string 'header-separator)))
"$")
nil t)))
(limit
(copy-marker
(cond ((not ispell-message-text-end) (point-max))
((char-or-string-p ispell-message-text-end)
(if (re-search-forward ispell-message-text-end nil t)
(match-beginning 0)
(point-max)))
(t (min (point-max) (funcall ispell-message-text-end))))))
(cite-regexp (regexp-quote kom-cite-string))
(cite-regexp-start (concat "^[ \t]*$\\|" cite-regexp))
(cite-regexp-end (concat "^\\(" cite-regexp "\\)"))
(old-case-fold-search case-fold-search)
(case-fold-search t)
(ispell-checking-message t)
(subject-string
(concat "^" (regexp-quote (lyskom-get-string 'subject)))))
(goto-char (point-min))
(while (if internal-messagep
(< (point) internal-messagep)
(not (eobp)))
(if (looking-at subject-string)
(progn (goto-char (match-end 0))
(let ((case-fold-search old-case-fold-search))
(ispell-region (point)
(progn
(end-of-line)
(point)))))
(forward-line 1)))
(while (< (point) limit)
(while (and (looking-at cite-regexp-start)
(< (point) limit)
(zerop (forward-line 1))))
(if (< (point) limit)
(let* ((start (point))
(end-c (and (re-search-forward cite-regexp-end limit 'end)
(match-beginning 0)))
(end-fwd (and (goto-char start)
(re-search-forward ispell-message-start-skip
limit 'end)))
(end (or (and end-c end-fwd (min end-c end-fwd))
end-c
end-fwd
(marker-position limit))))
(goto-char start)
(setq result (ispell-region start end))
(if (and end-fwd (= end end-fwd))
(progn (goto-char end)
(re-search-forward ispell-message-end-skip
limit 'end))
(goto-char end)))))
(set-marker limit nil)
result))
(when kill-ispell (ispell-kill-ispell t))
result))
(defun lyskom-edit-send-check-recipients (misc-list subject)
"Check that the recipients of this text are OK. Ask the user to
......
......@@ -74,6 +74,7 @@
(define-key lyskom-en-edit-mode-map [mouse-3] 'kom-mouse-null)
(define-key lyskom-en-edit-mode-map "\C-c*" 'kom-button-press)
(define-key lyskom-en-edit-mode-map "\C-c\C-c" 'kom-edit-send)
(define-key lyskom-en-edit-mode-map "\C-c\C-s" 'kom-ispell-message)
(define-key lyskom-en-edit-mode-map "\C-ck" 'kom-edit-quit)
(define-key lyskom-en-edit-mode-map "\C-c\C-k" 'kom-edit-quit)
(define-key lyskom-en-edit-mode-map "\C-cr?" 'lyskom-help)
......@@ -1301,6 +1302,7 @@ On since %#8s%#9s")
(kom-edit-send . "Send")
(kom-edit-send-anonymous . "Send anonymously")
(kom-edit-quit . "Throw away")
(kom-ispell-message . "Check spelling")
(kom-edit-add-recipient . "Add recipient")
(kom-edit-add-copy . "Add carbon copy")
(kom-edit-show-commented . "Review commented")
......@@ -2188,6 +2190,11 @@ Lists etc. : [INS] Add a line [DEL] Remove a line [*] Modify")
language will not be applied to the current setting. Use the Change
language command to do that.")
(kom-ispell-dictionary-doc . "\
This specifies the dictionary ispell is to use for spell checking. If set
to ispell-dictionary, then the variable ispell-dictionary will be used
instead.")
;;
;; Tags for variables
;;
......@@ -2291,6 +2298,7 @@ Lists etc. : [INS] Add a line [DEL] Remove a line [*] Modify")
(kom-customize-format-tag . "Show documentation for all settings:")
(kom-default-language-tag . "Default language:")
(kom-ispell-dictionary-tag . "Spelling dictionary:")
)
)
......
......@@ -208,6 +208,33 @@ the current buffer, and its value is copied from the LysKOM buffer."
(lyskom-default-value (quote (, keymap))))
(use-local-map (, keymap)))))
;;; ============================================================
;;; Widget gunk
;;;
(defmacro lyskom-widget-wrapper (fn)
(` (if (not (fboundp (quote (, fn))))
(defun (, fn) (&rest args)
(require 'custom) ; lww
(require 'widget) ; lww
(require 'wid-edit) ; lww
(require 'wid-browse) ; lww
(require 'cus-edit) ; lww
(require 'cus-face) ; lww
(apply (quote (, fn)) args)))))
(lyskom-widget-wrapper widget-at)
(lyskom-widget-wrapper widget-value)
(lyskom-widget-wrapper widget-button-click)
(lyskom-widget-wrapper widget-setup)
(lyskom-widget-wrapper widget-value-set)
(lyskom-widget-wrapper widget-insert)
(lyskom-widget-wrapper widget-create)
(lyskom-widget-wrapper widget-get)
(lyskom-widget-wrapper widget-put)
;;; ============================================================
;;; Local variables
;;;
......
......@@ -90,7 +90,8 @@
(defvar lyskom-edit-menu-template
'((menu lyskom
((item kom-edit-send)
((item kom-ispell-message)
(item kom-edit-send)
; (item kom-edit-send-anonymous)
(hline reciever-separator)
(item kom-edit-add-recipient)
......
......@@ -39,10 +39,6 @@
;;; Require Per Abrahamsens widget package, version 0.991 or later.
;;;
(require 'widget)
(autoload 'widget-at "wid-edit")
;;; ======================================================================
;;; Global variables
......@@ -130,6 +126,7 @@
section
"\n"
[kom-cite-string]
[kom-ispell-dictionary]
"\n"
sending-doc
"\n\n"
......@@ -483,7 +480,7 @@ customize buffer but do not save them to the server."
(kom-remote-control (toggle (on off)))
(kom-remote-controllers (repeat (person nil :tag name)))
(kom-self-control (toggle (yes no)))
(kom-ispell-dictionary (ispell-dictionary))
))
(defvar lyskom-widget-functions
......@@ -497,6 +494,7 @@ customize buffer but do not save them to the server."
(repeat . lyskom-repeat-widget)
(kbd-macro . lyskom-kbd-macro-widget)
(url-viewer . lyskom-url-viewer-widget)
(ispell-dictionary . lyskom-ispell-dictionary-widget)
(open-window . lyskom-open-window-widget)
(command . lyskom-command-widget)
(person . lyskom-person-widget)
......@@ -612,6 +610,27 @@ customize buffer but do not save them to the server."
':value (elt x 0))))
lyskom-languages)))
(defun lyskom-ispell-dictionary-widget (type &optional args propl)
(require 'ispell)
(list 'menu-choice
':format "%[%t%] %v"
':case-fold nil
':args
(cons (list 'item
':tag "ispell-dictionary"
':format "%t"
':value nil)
(delq nil
(mapcar
(function
(lambda (x)
(and (car x)
(list 'item
':tag (car x)
':format "%t"
':value (car x)))))
ispell-dictionary-alist)))))
(defun lyskom-url-viewer-widget (type &optional args propl)
(list 'menu-choice
':format "%[%v%]\n"
......
No preview for this file type
......@@ -43,13 +43,7 @@
;;; various files need to be loaded in a very specific order.
;;;
(require 'custom)
(require 'widget)
(require 'wid-edit)
(require 'wid-browse)
(require 'cus-edit)
(require 'cus-face)
;;; Define widget wrappers for all the functions in macros.el
;;;
;;; Lisp utility functions
......
......@@ -494,12 +494,10 @@ various LysKOM elements.")
;; URLs
("\\(www[^\\.\t \012 \"<>|\\]*\\|ftp\\|home[^\\.\t \012 \"<>|\\]*\\)\\.[^\t \012 \"<>|\\]*[^\t \012 \"<>|.,!(){}?'`:]"
("\\(www\\|ftp\\|home\\)\\.[^\t \012\014\"<>|\\]*[^\t \012\014\"<>|.,!(){}?'`:]"
pseudo-url 0 nil kom-url-face)
("\\(file://\\|ftp://\\|gopher://\\|http://\\|https://\\|news:\\|wais://\\|mailto:\\|telnet:\\)[^\t \012
\"<>|\\]*[^\t \012
\"<>|.,!(){}?'`:]"
("\\(file://\\|ftp://\\|gopher://\\|http://\\|https://\\|news:\\|wais://\\|mailto:\\|telnet:\\)[^\t \012\014\"<>|\\]*[^\t \012\014\"<>|.,!(){}?'`:]"
url 0 nil kom-url-face)
("<URL:\\s-*\\([^>]*\\)\\s-*>"
url 1 1 kom-url-face)
......
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