From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: About a programming tip Date: Thu, 21 Feb 2013 07:42:55 +0100 Organization: Emacs Helm Message-ID: <87y5eixj4g.fsf@gmail.com> References: <20130221095112.1c8466f4687368f36805ea40@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361429007 2184 80.91.229.3 (21 Feb 2013 06:43:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Feb 2013 06:43:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 21 07:43:50 2013 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 1U8Psg-0006ZJ-Ts for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Feb 2013 07:43:47 +0100 Original-Received: from localhost ([::1]:36174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8PsM-0000qS-Ff for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Feb 2013 01:43:26 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8PsA-0000q4-Af for help-gnu-emacs@gnu.org; Thu, 21 Feb 2013 01:43:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8Ps6-0005cO-0B for help-gnu-emacs@gnu.org; Thu, 21 Feb 2013 01:43:14 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:45985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Ps5-0005c3-Q3 for help-gnu-emacs@gnu.org; Thu, 21 Feb 2013 01:43:09 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U8PsM-0006PQ-Dk for help-gnu-emacs@gnu.org; Thu, 21 Feb 2013 07:43:26 +0100 Original-Received: from lbe83-2-78-243-104-167.fbx.proxad.net ([78.243.104.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Feb 2013 07:43:26 +0100 Original-Received: from thierry.volpiatto by lbe83-2-78-243-104-167.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 21 Feb 2013 07:43:26 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lbe83-2-78-243-104-167.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:uuGjYSZ4B0z3YALTYM7P9Dl6ADc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:89208 Archived-At: Xue Fuqiao writes: > In (info "(elisp) Programming Tips"): > > * In `interactive', if you use a Lisp expression to produce a list > of arguments, don't try to provide the "correct" default values for > region or position arguments. > [...] > You do not need to take such precautions when you use interactive > specs `d', `m' and `r', because they make special arrangements to > recompute the argument values on repetition of the command. > > I'm confused with these two sentences. The first sentence says that > "don't try to provide the 'correct' default values for region or > position arguments", but the second sentence says that "you don't need > to take such precautions when you use interactive specs `d', `m' and > `r'". IIRC the specs `d', `m' and `r' are "region or position > arguments". Where do I understand wrong, or is it a bug? Thanks. (defun foo-1 (beg end) (interactive (list (read-number "Beg: " (region-beginning)) (read-number "End: " (region-end)))) (message "%S" (buffer-substring beg end))) (defun foo (beg end) (interactive "r") (message "%S" (buffer-substring beg end))) In other words you don't have to use foo-1, it is easier to use foo. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997