From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: src block: 'C-c C-c can do nothing useful here' if cursor on blank line Date: Sat, 28 Jan 2017 00:00:00 +0100 Message-ID: <87d1f8t8gf.fsf@nicolasgoaziou.fr> References: <874m0k9s1i.fsf@ucl.ac.uk> <87wpdgb4lz.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXFV1-0005vz-2v for emacs-orgmode@gnu.org; Fri, 27 Jan 2017 18:00:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXFUy-0000z9-2t for emacs-orgmode@gnu.org; Fri, 27 Jan 2017 18:00:07 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:51089) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXFUx-0000y0-SZ for emacs-orgmode@gnu.org; Fri, 27 Jan 2017 18:00:04 -0500 In-Reply-To: (Charles C. Berry's message of "Fri, 27 Jan 2017 14:29:17 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" Cc: Kyle Meyer , emacs-orgmode@gnu.org Hello, "Charles C. Berry" writes: > Nor I. Perhaps it was just an oversight. > > FWIW, in `org-ctrl-c-ctrl-c' > > : (looking-at-p "[ \t]*$") > > could be > > #+BEGIN_SRC emacs-lisp > (and > (looking-at-p "[ \t]*$") > (not (eq 'src-block (org-element-type (org-element-context)))))) > #+END_SRC > > without causing a lot of grief. I think `src-block' is the only > relevant case. In almost all cases, you don't want C-c C-c to do anything on a blank line. Commit 0b6a2e2416b0acc28469661d7013f92f82a34267 pointed out before was pushed because calling C-c C-c on the blank lines right after a blank line would call `org-set-tags'. What you suggest is sub-optimal, tho. The point of this quick check is to eschew `org-element-context' call a few lines below. This would make two calls instead of one. I think a proper solution is to bite the bullet and make the check after calling `org-element-context', in a pcase branch. This is what I did in ebb9da0d0. Please let me know if it doesn't solve the issue. Regards, -- Nicolas Goaziou