From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ishi soichi Newsgroups: gmane.emacs.help Subject: set-marker and make-marker, Wrong type argument: integer-or-marker-p, nil Date: Sun, 29 Jul 2012 10:38:00 +0900 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b622096d7739c04c5edfe04 X-Trace: dough.gmane.org 1343525888 16757 80.91.229.3 (29 Jul 2012 01:38:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 Jul 2012 01:38:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 29 03:38:09 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SvISO-0001Si-1c for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Jul 2012 03:38:08 +0200 Original-Received: from localhost ([::1]:48861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvISN-0004yQ-B8 for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Jul 2012 21:38:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvISI-0004yJ-Up for help-gnu-emacs@gnu.org; Sat, 28 Jul 2012 21:38:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SvISH-00051r-UG for help-gnu-emacs@gnu.org; Sat, 28 Jul 2012 21:38:02 -0400 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:35550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvISH-00051g-M5 for help-gnu-emacs@gnu.org; Sat, 28 Jul 2012 21:38:01 -0400 Original-Received: by eeke49 with SMTP id e49so978944eek.0 for ; Sat, 28 Jul 2012 18:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=u0hy89m0YEO5wHpJSg82OHcqz3fL6JIsiUOrXqoXNNg=; b=JDPzpGd5hn1ikKmvvCTUApVk+thr3mEMRvG4wVVzg2RPlxAh0J1MSptKQuyFWQiLKY TzGfz6xqyrcc07y4+izlQ2Wt59gRWBaot9Cgxv9zYN4TxoiLD0gU1ytpLravEbfdAxun RKIKsa6S7B8K4FCshRMe3OnCm9cqK4KgEk6R02/I+ch3gNL7/7NXApYWFM5vNrcvPCRs JQMwhUCZrNXS8GtXLaGd0/6lPs13Z8/LiiTaUssuH96Lcg3wobeN/rpWoP0DYRwoVnTf lsj7WDMwnRZUr9EABEqSabbhoobKv/+TW7izlFHbXKrIIcXwNDI+AjRI0iV81KZfJi+0 H7Lg== Original-Received: by 10.14.179.71 with SMTP id g47mr7613443eem.21.1343525880296; Sat, 28 Jul 2012 18:38:00 -0700 (PDT) Original-Received: by 10.14.38.193 with HTTP; Sat, 28 Jul 2012 18:38:00 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86121 Archived-At: --047d7b622096d7739c04c5edfe04 Content-Type: text/plain; charset=ISO-8859-1 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 It looks like (set-marker ... part is doing something wrong. Could anyone point out the mistake I am making? soichi --047d7b622096d7739c04c5edfe04 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Emacs23

=A0This should be simple for many of you.=A0
I am trying to develop a function that searches a word definition st= ored in a dict file.

As you can see, when reading = a text, you might need to look for additional information about the encount= ered word.
The following function searches the information for the word in the re= gion.


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

(defun sfl-search-word-meaning ()
=A0 (intera= ctive)
=A0 (let ((word=A0
(buffer-substring (region-beginning) (= region-end)))
(resu= lt))=A0
=A0 =A0 (with-current-buffer
=A0 =A0 =A0(find-f= ile (concat sfl-dictionary-directory "/" sfl-base-dict-file))
=A0 =A0 =A0(goto-char (point-min))
=A0 =A0 =A0(search-forward word)
=A0 =A0 =A0(set-marker (mak= e-marker) (beginning-of-line))
=A0 =A0 =A0(goto-char (end-of-line= ))
=A0 =A0 =A0(setq result (buffer-substring (region-beginning) (= region-end)))
=A0 =A0 =A0(message result))))


But this gives an error

save-current-buffer: Wro= ng type argument: integer-or-marker-p, nil

It look= s like (set-marker ... part is doing something wrong.

Could anyone point out the mistake I am making?

soichi
--047d7b622096d7739c04c5edfe04--