diff options
author | Torsten Hilbrich <torsten.hilbrich@gmx.net> | 2013-07-03 05:22:41 +0200 |
---|---|---|
committer | Torsten Hilbrich <torsten.hilbrich@gmx.net> | 2013-07-05 18:16:35 +0200 |
commit | bd8f0a1933f8ab86c62d968ad06e09dbe0c7e8c8 (patch) | |
tree | 2bc6c00f243dc4be847c94bcaa0fee00af0ffda4 | |
parent | a6cf022b5ac9395e31ebdc33b9b6c3b633fda665 (diff) |
dictionary: Replace mapcar with mapc where possible
mapc doesn't return the result, mapcar does. So if the result of the
call is not needed, prefer mapc here.
-rwxr-xr-x | dictionary.el | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/dictionary.el b/dictionary.el index 2e5bdda..aed7af1 100755 --- a/dictionary.el +++ b/dictionary.el @@ -840,7 +840,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-dictionary-line "! \"The first matching dictionary\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapcar 'dictionary-display-dictionary-line list)) + (mapc 'dictionary-display-dictionary-line list)) (dictionary-post-buffer)) (defun dictionary-display-dictionary-line (string) @@ -929,7 +929,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-strategy-line ". \"The servers default\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapcar 'dictionary-display-strategy-line list)) + (mapc 'dictionary-display-strategy-line list)) (dictionary-post-buffer)) (defun dictionary-display-strategy-line (string) @@ -994,18 +994,18 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (insert number " matching word" (if (equal number "1") "" "s") " found\n\n") (let ((result nil)) - (mapcar (lambda (item) - (let* ((list (dictionary-split-string item)) - (dictionary (car list)) - (word (cadr list)) - (hash (assoc dictionary result))) - (if dictionary - (if hash - (setcdr hash (cons word (cdr hash))) - (setq result (cons - (cons dictionary (list word)) - result)))))) - list) + (mapc (lambda (item) + (let* ((list (dictionary-split-string item)) + (dictionary (car list)) + (word (cadr list)) + (hash (assoc dictionary result))) + (if dictionary + (if hash + (setcdr hash (cons word (cdr hash))) + (setq result (cons + (cons dictionary (list word)) + result)))))) + list) (dictionary-display-match-lines (reverse result))))) (defun dictionary-display-match-result (reply) @@ -1017,38 +1017,38 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (insert number " matching word" (if (equal number "1") "" "s") " found\n\n") (let ((result nil)) - (mapcar (lambda (item) - (let* ((list (dictionary-split-string item)) - (dictionary (car list)) - (word (cadr list)) - (hash (assoc dictionary result))) - (if dictionary - (if hash - (setcdr hash (cons word (cdr hash))) - (setq result (cons - (cons dictionary (list word)) - result)))))) - list) + (mapc (lambda (item) + (let* ((list (dictionary-split-string item)) + (dictionary (car list)) + (word (cadr list)) + (hash (assoc dictionary result))) + (if dictionary + (if hash + (setcdr hash (cons word (cdr hash))) + (setq result (cons + (cons dictionary (list word)) + result)))))) + list) (dictionary-display-match-lines (reverse result)))) (dictionary-post-buffer)) (defun dictionary-display-match-lines (list) "Display the match lines." - (mapcar (lambda (item) - (let ((dictionary (car item)) - (word-list (cdr item))) - (insert "Matches from " dictionary ":\n") - (mapcar (lambda (word) - (setq word (dictionary-decode-charset word dictionary)) - (insert " ") - (link-insert-link word - 'dictionary-reference-face - 'dictionary-new-search - (cons word dictionary) - "Mouse-2 to lookup word") - (insert "\n")) (reverse word-list)) - (insert "\n"))) - list)) + (mapc (lambda (item) + (let ((dictionary (car item)) + (word-list (cdr item))) + (insert "Matches from " dictionary ":\n") + (mapc (lambda (word) + (setq word (dictionary-decode-charset word dictionary)) + (insert " ") + (link-insert-link word + 'dictionary-reference-face + 'dictionary-new-search + (cons word dictionary) + "Mouse-2 to lookup word") + (insert "\n")) (reverse word-list)) + (insert "\n"))) + list)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User callable commands |