Skip to content

Commit

Permalink
s/match-string/match-string-no-properties/g
Browse files Browse the repository at this point in the history
  • Loading branch information
unhammer committed Oct 28, 2011
1 parent 005532e commit 2392e08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions pertbot-apertium-pairs.el
Expand Up @@ -29,7 +29,7 @@
(remove
nil
(mapcar (lambda (l) (when (string-match "\\(.*\\)-\\(.*\\)" l)
(concat (match-string 2 l) "-" (match-string 1 l))))
(concat (match-string-no-properties 2 l) "-" (match-string-no-properties 1 l))))
(pertbot-lang-pairs))))))

(defvar pertbot-lang-codes-cached nil)
Expand All @@ -39,7 +39,7 @@
(setq pertbot-lang-codes-cached
(apply #'append
(mapcar (lambda (l) (when (string-match "\\(.*\\)-\\(.*\\)" l)
(list (match-string 2 l) (match-string 1 l))))
(list (match-string-no-properties 2 l) (match-string-no-properties 1 l))))
(pertbot-lang-pairs))))))


Expand All @@ -57,10 +57,10 @@ means e.g. \"nob\" and \"nb\" will be treated the same."
(lambda (pair)
(when (string-match "\\(.*\\)-\\(.*\\)" pair)
(let ((basename (concat "apertium-" pair))
(iso1 (or (cdr (assoc (match-string 1 pair) iso-639-language-codes))
(match-string 1 pair)))
(iso2 (or (cdr (assoc (match-string 2 pair) iso-639-language-codes))
(match-string 2 pair))))
(iso1 (or (cdr (assoc (match-string-no-properties 1 pair) iso-639-language-codes))
(match-string-no-properties 1 pair)))
(iso2 (or (cdr (assoc (match-string-no-properties 2 pair) iso-639-language-codes))
(match-string-no-properties 2 pair))))
(puthash iso1
(cons basename (gethash iso1 pertbot-langs-pairs-cached))
pertbot-langs-pairs-cached)
Expand All @@ -80,7 +80,7 @@ language."

(defun pertbot-handle-pairs (msg)
(if (string-match "^\\s *,pairs\\s +\\(\\S +*\\)\\s *\n" msg)
(let* ((code (match-string 1 msg))
(let* ((code (match-string-no-properties 1 msg))
(pairs (pertbot-get-pairs-of-langcode code))
(pairstr (apply #'concat (mapcar (lambda (p)
(format "%s " p))
Expand Down
12 changes: 6 additions & 6 deletions pertbot-translate.el
Expand Up @@ -25,8 +25,8 @@

(defun pertbot-handle-translate (msg)
(if (string-match "^\\s *,translate\\s +\\(\\S +-\\S +*\\)\\s +\\(.*\\)\n" msg)
(let* ((dir (match-string 1 msg))
(input (match-string 2 msg)))
(let* ((dir (match-string-no-properties 1 msg))
(input (match-string-no-properties 2 msg)))
(if (member dir (pertbot-installed-dirs))
(let ((output (pertbot-translate-helper dir input)))
(if output
Expand All @@ -46,8 +46,8 @@
(defvar pertbot-followed (make-hash-table :test 'equal))
(defun pertbot-handle-follow (nickuserhost msg)
(if (string-match "^\\s *,follow\\s +\\(\\S +\\)\\s +\\(\\S +-\\S +*\\)\\s *\n" msg)
(let* ((followed (match-string 1 msg))
(dir (match-string 2 msg))
(let* ((followed (match-string-no-properties 1 msg))
(dir (match-string-no-properties 2 msg))
(follower (car (split-string nickuserhost "!"))))
(if (member dir (pertbot-installed-dirs))
(let ((otherfollowers (unassoc follower
Expand All @@ -63,7 +63,7 @@
(erc-send-message "where DIRECTION is an apertium language pair direction, e.g. es-ca")))
(defun pertbot-handle-unfollow (nickuserhost msg)
(if (string-match "^\\s *,unfollow\\s +\\(\\S +\\)\\s *\n" msg)
(let* ((followed (match-string 1 msg))
(let* ((followed (match-string-no-properties 1 msg))
(follower (car (split-string nickuserhost "!")))
(otherfollowers (unassoc follower
(gethash followed pertbot-followed))))
Expand All @@ -72,7 +72,7 @@
(puthash followed
otherfollowers
pertbot-followed)
(erc-send-message (format "Unfollowing %s for %s" followed follower)))
(erc-send-message (format "Unfollowing %s for %s " followed follower)))
(erc-send-message "Usage: ,unfollow NICK")))

(defun pertbot-handle-follow-match (nickuserhost msg)
Expand Down
4 changes: 2 additions & 2 deletions pertbot.el
Expand Up @@ -16,7 +16,7 @@

(defun pertbot-handle-iso (msg)
(if (string-match "^\\Sw*,iso\\Sw+\\(...?\\)\\Sw*\n" msg)
(let* ((code (match-string 1 msg))
(let* ((code (match-string-no-properties 1 msg))
(lang (assoc code iso-639-language-codes))
(reply (if lang
(format "ISO language code \"%s\" is %s" code (cdr lang))
Expand All @@ -28,7 +28,7 @@
(defun pertbot-handle-match (match-type nickuserhost msg)
(cond ((eq match-type 'keyword)
(string-match "^\\Sw*,\\Sw*\\(\\sw+\\)" msg)
(let* ((key (downcase (match-string 1 msg)))
(let* ((key (downcase (match-string-no-properties 1 msg)))
(simple-answer (assoc key pertbot-simple-answers)))
(cond ((equal key "iso") (pertbot-handle-iso msg))
;; TODO: use the method in `pcomplete-erc-commands'
Expand Down

0 comments on commit 2392e08

Please sign in to comment.