From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: To Drew Adams?: `dired-get-marked-files' returns error when notonfile Date: Wed, 7 Jul 2010 09:39:52 -0700 Message-ID: <506078A2F94A4692B54E7E6136AD861D@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278520943 7947 80.91.229.12 (7 Jul 2010 16:42:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 7 Jul 2010 16:42:23 +0000 (UTC) To: , "'emacs mailing list'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 07 18:42:22 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OWXhQ-0006sh-I1 for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Jul 2010 18:42:16 +0200 Original-Received: from localhost ([127.0.0.1]:40046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWXhP-0003Dv-Km for geh-help-gnu-emacs@m.gmane.org; Wed, 07 Jul 2010 12:42:15 -0400 Original-Received: from [140.186.70.92] (port=40730 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWXgs-0003Dg-LS for help-gnu-emacs@gnu.org; Wed, 07 Jul 2010 12:41:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWXgr-0002r5-Gk for help-gnu-emacs@gnu.org; Wed, 07 Jul 2010 12:41:42 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:54091) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWXgr-0002qY-BA for help-gnu-emacs@gnu.org; Wed, 07 Jul 2010 12:41:41 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o67GfZo9003533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 7 Jul 2010 16:41:36 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o66ML9BE019725; Wed, 7 Jul 2010 16:41:34 GMT Original-Received: from abhmt016.oracle.com by acsmt354.oracle.com with ESMTP id 386306221278520791; Wed, 07 Jul 2010 09:39:51 -0700 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Jul 2010 09:39:51 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcsdTGIOHLBolvqISM6V6n5qj1/+EwAAVXggACkTnwA= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090201.4C34AE3E.0256:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74126 Archived-At: > > I have the impression `dired-get-marked-files' should return > > nil instead signal an error (or at least parameterised) when > > I am in dired buffer and I am pointing on empty line after > > all files. > > > > why? because how can I handle such situation cleanly in elisp code? > > `dired-get-marked-files' raises an error in this case. > It calls `dired-get-filename', which raises the error because > there is no file listed on that line. BTW - There is a good reason for not returning nil, which means there are no marked files. If you do in fact have some marked files, and you hit a key to perform some task on those files, you generally do not want the set of marked files to be considered empty and the command to act based on that erroneous assumption. And if there are no marked files, or if you use a prefix arg, then `dired-get-marked-files' returns the next ARG files, including the file under the cursor. If the cursor is not on a file line then this is problematic, and an error is in order.