From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Help setting nadvice for indent-region Date: Fri, 05 Feb 2016 23:49:08 +0000 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1454716180 15788 80.91.229.3 (5 Feb 2016 23:49:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Feb 2016 23:49:40 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 06 00:49:39 2016 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 1aRq87-0001ep-GE for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Feb 2016 00:49:35 +0100 Original-Received: from localhost ([::1]:50912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRq83-0002gD-FN for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Feb 2016 18:49:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRq7s-0002di-6Y for help-gnu-emacs@gnu.org; Fri, 05 Feb 2016 18:49:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRq7r-0002cL-8b for help-gnu-emacs@gnu.org; Fri, 05 Feb 2016 18:49:20 -0500 Original-Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:36165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRq7r-0002cH-3m for help-gnu-emacs@gnu.org; Fri, 05 Feb 2016 18:49:19 -0500 Original-Received: by mail-oi0-x22a.google.com with SMTP id x21so51012559oix.3 for ; Fri, 05 Feb 2016 15:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=4P34fUTS3pZ2Lxs0VbwGaCdeCBqQk6X5yQao6XL52r4=; b=zuhRdiE5QVECexBgFfp2/cvzttpLbbEZxoqlg2ogo6zzjFOv77IKUADhOAclBWg1oW jW0VKdmJRnd/H6rSAtA2yP9TYco/83R00npO6HmS/XGR7LY0K5OaGqFYsI8ftvbcFuun NHAInSQOowoglDw0aqCBnnuErgesf/UhcrCk9KOlQQv19oKA/UZI9Xjtx0QcmEQhTBVo IDPzIyweBwXeENs0frAbmd8ARyD1GiF5L7jWjLk5BZKDFV3/ZyR+Gs3nyGmgRK9cBDzv l9A0/oIpuM/ePFqCLD4XH+P2fEt51T3gyoP6FejycGj78qL56aVmcTfOvgyo/K4wPRkv Jovw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=4P34fUTS3pZ2Lxs0VbwGaCdeCBqQk6X5yQao6XL52r4=; b=j97ocdp5duD0KY2ncPL1vXXu4nvAl9XeF7s0VfVoIWknceh8mIf6esMnaZf/nMuLjA 7oq1LUQi/N52mKZ5rW7EtmayWymHxHQwYAaAkXPnkZo5OoXkN9eCFR7dih339DHo45RE hhpVZnV5LNpQJxAJGWeQelxAWcIiNUqaFoMT041ZdsbGu+YdMZ0Fp7NenmUt7GPpK3Ym qorrisDRj5L6x44YfHLzKa+K3BQa/Fhh/anplg6oIyRXwC8VjyY0AxUf8OIT8sDn1GYY SEU9+lE9FfkQiUJHQvGxpxgsXoNZJqLjpBqR7+vW8XxSc4BDC+srMmWGBWRcxCwPoz8A Qh9g== X-Gm-Message-State: AG10YORxP7rnMQwDSLgMHEVLHCJrC4NYQKDT+Oun35lnipENpuWYc8zTMK31+ZB4SZRkHSyljhhc2wXc3tvk+g== X-Received: by 10.202.75.13 with SMTP id y13mr10204933oia.116.1454716158599; Fri, 05 Feb 2016 15:49:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22a X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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:109025 Archived-At: Hi, I'd like to advice indent-region so that if a region is not select, it indents between (point-min) and (point-max). So I have this: ===== (defun adv/indent-region (args) (when (not mark-active) (setq args (list (point-min) (point-max)))) args) (advice-add 'indent-region :filter-args #'adv/indent-region) ===== This usually works, unless I have just launched a fresh buffer in which there is no mark set. If I do M-: (mark) in that buffer, I get nil. In that case, if I call M-x indent-region (with no region selected), I get this error backtrace: Debugger entered--Lisp error: (error "The mark is not set now, so there is no region") call-interactively(indent-region nil nil) command-execute(indent-region) If it looks like the error is triggered by call-interactively even before the advice gets to do its thing. How can I resolve this using nadvice? Thanks. Kaushal Modi