From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: set-marker and make-marker, Wrong type argument: integer-or-marker-p, nil Date: Sun, 29 Jul 2012 11:08:15 +0530 Message-ID: <81boizi0u0.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1343540325 29861 80.91.229.3 (29 Jul 2012 05:38:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 Jul 2012 05:38:45 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: ishi soichi Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 29 07:38:45 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 1SvMDC-0001ii-To for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Jul 2012 07:38:43 +0200 Original-Received: from localhost ([::1]:34352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvMDB-0006XC-Q5 for geh-help-gnu-emacs@m.gmane.org; Sun, 29 Jul 2012 01:38:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvMD6-0006X4-Qn for help-gnu-emacs@gnu.org; Sun, 29 Jul 2012 01:38:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SvMD5-0000B9-M2 for help-gnu-emacs@gnu.org; Sun, 29 Jul 2012 01:38:36 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:39988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SvMD5-0000B3-Ex for help-gnu-emacs@gnu.org; Sun, 29 Jul 2012 01:38:35 -0400 Original-Received: by pbbrp2 with SMTP id rp2so8497591pbb.0 for ; Sat, 28 Jul 2012 22:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=GJC+A+9SkVslYywict91RtpPMg5zhHshq1hKkOn1a74=; b=dnbz8My7Sk/D01VvbYV95IgDARiXGU+Z8+db2xh0l0gn8ar0ZDV0bNzq+meDnft36D ZfVrJ3XWcuXMsfFF560fa2Ak0olR4T1fLQ0d5aiU8C80pK1Gy+l+BfZzsEaz/Ew3ptoG txJTt3IpCiOkRQ3BRvQ8XF85FADChvRFK395iiRQWmgY9WpEqgNQ8PD2g9nEXfexwbhp ytLBpoqlGhqtwe/A8S/1EMblIRq7l+BX2q1RiWGRIhGjlO7AtSurCH9jp/WK71eVqObB FEnlRZIJNWemecC/rTa6SFfNOx9T2dWzG9in2gT0y7U95TQU1lGRScrUuUCg8tSovHcU McTw== Original-Received: by 10.68.200.8 with SMTP id jo8mr25315477pbc.148.1343540314176; Sat, 28 Jul 2012 22:38:34 -0700 (PDT) Original-Received: from JAMBU-NETBOOK ([101.63.151.142]) by mx.google.com with ESMTPS id qd10sm5244295pbb.38.2012.07.28.22.38.31 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 28 Jul 2012 22:38:33 -0700 (PDT) In-Reply-To: (ishi soichi's message of "Sun, 29 Jul 2012 10:38:00 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.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:86122 Archived-At: ishi soichi writes: > Emacs23 > > =C2=A0This should be simple for many of you.=C2=A0 > 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 () > =C2=A0 (interactive) > =C2=A0 (let ((word=C2=A0 > (buffer-substring (region-beginning) (region-end))) > (result))=C2=A0 Look at "r" construct of C-h f interactive. > =C2=A0 =C2=A0 (with-current-buffer > =C2=A0 =C2=A0 =C2=A0(find-file (concat sfl-dictionary-directory "/" > sfl-base-dict-file)) > =C2=A0 =C2=A0 =C2=A0(goto-char (point-min)) > =C2=A0 =C2=A0 =C2=A0(search-forward word) > =C2=A0 =C2=A0 =C2=A0(set-marker (make-marker) (beginning-of-line)) > =C2=A0 =C2=A0 =C2=A0(goto-char (end-of-line)) > =C2=A0 =C2=A0 =C2=A0(setq result (buffer-substring (region-beginning) (re= gion-end))) > =C2=A0 =C2=A0 =C2=A0(message result)))) To take a `buffer-substring' you don't need a region or set markers. Simply any two points will do. How about (buffer-substring-no-properties (point-at-bol) (point-at-eol)) If you are searching, and have a successful match you can do for example, (buffer-substring-no-properties (match-beginning 0) (match-end 0)) I am not trying to solve your particular problem. I am just giving hints for you to proceed ahead. =20=20 > 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 > > --=20