Commit 308fd481 authored by David Byers's avatar David Byers
Browse files

Fix bugs 923 and 880

parent daab8933
2002-12-09 David Byers <david.byers@swipnet.se>
Bug 923:
* vars.el.in (kom-url-transformation-rules): New variable.
* lyskom-buttons.el (lyskom-transform-url): New function.
(lyskom-button-open-url): Use lyskom-transform-url.
2002-11-26 David Byers <david.byers@swipnet.se>
Fix bug 880 and related problems:
* commands1.el (lyskom-read-mark-type): Ditto.
* lyskom-rest.el (lyskom-read-number): Permit whitespace around
the input.
2002-11-21 David Byers <david.byers@swipnet.se>
Fix compiler warnings for 21.3:
* lyskom-buttons.el (lyskom-generate-button): Protect call to car
that was done to cause an error if menu-title was not a cons from
warnings in the byte compiler.
......
......@@ -2094,7 +2094,7 @@ exist."
(setq mark-type (cdr mark-assoc)))
;; Incorrect completion, integer entered.
((string-match "\\`[0-9]+\\'" mark)
((string-match "\\`\\s-*[0-9]+\\s-*\\'" mark)
(setq mark-type (string-to-int mark)))
;; Incorrect completion; create new symbolic mark type.
......
......@@ -2737,6 +2737,8 @@ Select whether to execute command or keyboard macro.")
(some-person . "Person")
(format-html . "Format HTML:")
(url-transform-regexp . "From (regexp):")
(url-transform-newtext . " To:")
;;
;; Misc doc strings
;;
......@@ -3661,6 +3663,15 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
marked as read in any conferences they are added to. This only works
as long as the LysKOM session is logged in. Texts are never
automatically marked as read in your mailbox.")
(kom-url-transformation-rules-doc . "\
Rules for transformation of URLs before they are sent to a web browser.
\"From\" is a regexp that is replaced by \"To\". Regexps are documented
in the Emacs manual. The string in \"To\" can contain the following
special sequences:
\\& means substitute original matched text,
\\N means substitute match for (...) number N,
\\\\ means insert one \\.")
;;
......@@ -3840,6 +3851,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-keyboard-menu-immediate-selection-tag . "Shortcuts in text menus require confirmation:")
(kom-max-overlays-tag . "Maximum number of overlays:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Mark read texts read when added to new recipients:")
(kom-url-transformation-rules-tag . "Transformation of URLs:")
)
)
......
......@@ -799,12 +799,20 @@ This is a LysKOM button action."
(kill-new (replace-in-string text "\\s-+" "")))
(defun lyskom-transform-url (url)
(let ((rules kom-url-transformation-rules))
(while rules
(setq url (replace-in-string url (car (car rules)) (cdr (car rules)))
rules (cdr rules))))
url)
(defun lyskom-button-open-url (buf arg text)
"In the LysKOM buffer BUF, ignore ARG and open TEXT as an URL.
This is a LysKOM button action."
(let* ((url (lyskom-fix-pseudo-url (replace-in-string text "\\s-+" "")))
protocol
url-manager)
(setq url (lyskom-transform-url url))
(string-match lyskom-url-protocol-regexp url)
(setq protocol (match-string 1 url))
(setq url-manager (lyskom-get-url-manager protocol))
......
......@@ -3393,7 +3393,7 @@ to return nil."
(setq number numdefault done t))
((and (string= numstr "") nildefault)
(setq number nil done t))
((string-match "\\`[0-9]+\\'" numstr)
((string-match "\\`\\s-*[0-9]+\\s-*\\'" numstr)
(setq number (string-to-int numstr))
(setq done number))
(t (beep))))
......
......@@ -1544,7 +1544,9 @@ Medlemskap f
Avsluta: C-c C-c Mer hjälp: C-h m
")
buf
))))
))
(lyskom-wait-queue 'deferred)
))
(defun lyskom-read-time (prompt)
......
......@@ -226,6 +226,7 @@
(urls bold centered)
section
"\n"
[kom-url-transformation-rules]
[kom-url-viewer-preferences]
[kom-windows-browser-command]
[kom-mosaic-command]
......@@ -726,6 +727,8 @@ customize buffer but do not save them to the server."
(kom-extended-status-information (toggle (yes no)))
(kom-edit-hide-add-button (noggle (yes no)))
(kom-keyboard-menu-immediate-selection (noggle (yes no)))
(kom-url-transformation-rules (repeat (cons ((string nil :tag url-transform-regexp)
(string nil :tag url-transform-newtext)))))
))
(defvar lyskom-widget-functions
......
......@@ -2791,6 +2791,9 @@ teckenkodning.
(some-person . "Person")
(format-html . "Formattera HTML:")
(url-transform-regexp . "Frn (regexp):")
(url-transform-newtext . " Till:")
;;
;; Misc doc strings
;;
......@@ -3721,6 +3724,16 @@ i servern. Annars sparas det i din .emacs.")
mten de adderas till medan man r inloggad. Om man inte r inloggad
s sker inte denna lsmarkering. Inlgg som adderas till ens brevlda
lsmarkeras dock aldrig automatiskt.")
(kom-url-transformation-rules-doc . "\
Regler fr att transformera URLer innan de skickas till en webblsare.
\"Frn\" r ett mnster (en regexp) som skall versttas till texten
i \"Till\". Dokumentation om regexpar finns i Emacs-manualen. \"Till\"
kan innehlla fljande specialtecken:
\\& erstts med den text som matchar regexpen
\\N erstts med den text som matchar (...)-uttryck N i regexpen
\\\\ erstts med en \\.")
;;
......@@ -3900,6 +3913,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-keyboard-menu-immediate-selection-tag . "Snabbval i textmenyer krver bekrftelse:")
(kom-max-overlays-tag . "Hgsta antal frgmarkeringar:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Markera lsta inlgg lsta ven i nya mottagare:")
(kom-url-transformation-rules-tag . "Transformation av URLer:")
)
)
......
......@@ -196,6 +196,20 @@ The cdrs on the list may be either of:
(funcall my-get-text-no (abs prefix-arg) prompt default nil 17 4711)."
)
(def-kom-var kom-url-transformation-rules
'(("http://[^/]*aftonbladet\\.se/.*" . "\\&."))
"*An alist specifying transformations to be applied to URLs.
Elements in this list are of the form `(REGEXP . NEWTEXT)'. Before an
URL is opened, it is transformed by replacing REGEXP with NEWTEXT.
Each element in the list is applied in order.
The list elements REGEXP and NEWTEXT correspond to the REGEXP and
NEWTEXT arguments to `replace-in-string'."
server
)
(def-kom-var kom-check-configuration-on-startup t
"*When non-nil, check Emacs configuration on client startup.")
......
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