aboutsummaryrefslogtreecommitdiff
path: root/dictionary.el
diff options
context:
space:
mode:
authorTorsten Hilbrich <torsten.hilbrich@gmx.net>2013-05-08 21:03:38 +0200
committerTorsten Hilbrich <torsten.hilbrich@gmx.net>2013-05-08 21:52:24 +0200
commit3a461aec5aa5b78a1ad8919eab11abfb0d5d65b3 (patch)
treebe370ec8f4996233dc9453d058b0f2faaf868db8 /dictionary.el
parentaf254899a5507a776ee7291ae6ace7cc280eedfe (diff)
word-definition: Fix creation of links to word definition
match-beginning was called with 1 instead of 2 when calculating match-start. This is clearly wrong. Also small changes in the code, first calculate, then replace, this fixed a little problem with the link placement. Also fixing the documentation for the dictionary-color-support variable.
Diffstat (limited to 'dictionary.el')
-rwxr-xr-xdictionary.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/dictionary.el b/dictionary.el
index 9548127..a5885c3 100755
--- a/dictionary.el
+++ b/dictionary.el
@@ -295,7 +295,7 @@ by the choice value:
(condition-case nil
(x-display-color-p)
(error nil))
- "Stores the point position while buffer display.")
+ "Determines if the Emacs has support to display color")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic function providing startup actions
@@ -764,18 +764,17 @@ This function knows about the special meaning of quotes (\")"
(goto-char start)
(while (< (point) (point-max))
(if (search-forward-regexp regexp nil t)
- (let ((match-start (match-beginning 1))
+ (let ((match-start (match-beginning 2))
(match-end (match-end 2)))
(if dictionary-color-support
- (progn
- (replace-match "\\2")
- ;; Compensate for the replacement
- (let ((brace-match-length (- (match-end 1)
- (match-beginning 1))))
- (setq match-start (- (match-beginning 2)
- brace-match-length))
- (setq match-end (- (match-end 2)
- brace-match-length)))))
+ ;; Compensate for the replacement
+ (let ((brace-match-length (- (match-end 1)
+ (match-beginning 1))))
+ (setq match-start (- (match-beginning 2)
+ brace-match-length))
+ (setq match-end (- (match-end 2)
+ brace-match-length))
+ (replace-match "\\2")))
(dictionary-mark-reference match-start match-end
'dictionary-new-search
word dictionary))