help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set-marker and make-marker, Wrong type argument: integer-or-marker-p


From: Andreas Röhler
Subject: Re: set-marker and make-marker, Wrong type argument: integer-or-marker-p, nil
Date: Sun, 29 Jul 2012 20:35:17 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120601 Thunderbird/13.0

Am 29.07.2012 03:38, schrieb ishi soichi:
Emacs23

  This should be simple for many of you.
I am trying to develop a function that searches a word definition stored in
a dict file.

As you can see, when reading a text, you might need to look for additional
information about the encountered word.
The following function searches the information for the word in the region.


(defvar sfl-dictionary-directory "~/Dropbox/ElmLab/dict")
(defvar sfl-base-dict-file "test5.txt")

(defun sfl-search-word-meaning ()
   (interactive)
   (let ((word
  (buffer-substring (region-beginning) (region-end)))
(result))
     (with-current-buffer
      (find-file (concat sfl-dictionary-directory "/" sfl-base-dict-file))
      (goto-char (point-min))
      (search-forward word)
      (set-marker (make-marker) (beginning-of-line))
      (goto-char (end-of-line))
      (setq result (buffer-substring (region-beginning) (region-end)))
      (message result))))


But this gives an error

save-current-buffer: Wrong type argument: integer-or-marker-p, nil

IMO this error is raised from inside `with-current-buffer'.

Seems it doesn't get the return value it expects, which looks like a bug for me,
as docstring doesn't mention a required return value, .

The result of last form "message" will be a string, which seems not being 
accepted.

Andreas





It looks like (set-marker ... part is doing something wrong.

Could anyone point out the mistake I am making?

soichi






reply via email to

[Prev in Thread] Current Thread [Next in Thread]