From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mICZKpbNHGCDegAA0tVLHw (envelope-from ) for ; Fri, 05 Feb 2021 04:46:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id wGp8JpbNHGD+PwAA1q6Kng (envelope-from ) for ; Fri, 05 Feb 2021 04:46:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 25E1B9402AB for ; Fri, 5 Feb 2021 04:46:14 +0000 (UTC) Received: from localhost ([::1]:36950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7t0W-0000QL-K3 for larch@yhetil.org; Thu, 04 Feb 2021 23:46:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7szk-0000QA-3J for emacs-orgmode@gnu.org; Thu, 04 Feb 2021 23:45:24 -0500 Received: from out1.migadu.com ([91.121.223.63]:56770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7szg-0005sZ-C8 for emacs-orgmode@gnu.org; Thu, 04 Feb 2021 23:45:23 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1612500316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OiRMi4a4QketGdhnJyHquGLOItn9acmuIPRxP6w7Lv8=; b=ZABkoApz7mI7Zl1bsNxzQjPw54vTGStN6MNbikA2Gy8xBuZNstS8XGCJyvx7OjvRjPt3Pz Fj4gz0zhpZNGNzO65K/b1WNfrYkQ8IqK3+Tzs6Ua2ykUyCmst55NH6ASgEK5puzeAhSL6p RENhtw/jdLTprz6vPiy4QYEZG+e8mP+6o9ebCtK//zYTwC8ehW11bJXPBfRVSXXHEj33s7 0NUt3GvedMK6+tWIAyGo3qqBmGLJ9MARaad/ksOHDwC007z7AZF+mTibcJEMkChTKSbhp6 57baizJemYT2Bnz2j9bLoATiDEKxLnKi9+C2yx27UtbqDV6G3gwvZ0upVmwM7w== From: Kyle Meyer To: Eric Abrahamsen Subject: Re: Free up C-c SPC/org-table-blank-field? In-Reply-To: <871rdv6upl.fsf@ericabrahamsen.net> References: <87im7k51u0.fsf@ericabrahamsen.net> <875z39y8ua.fsf@kyleam.com> <871rdv6upl.fsf@ericabrahamsen.net> Date: Thu, 04 Feb 2021 23:45:14 -0500 Message-ID: <87lfc3f7hh.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=91.121.223.63; envelope-from=kyle@kyleam.com; helo=out1.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -0.05 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=ZABkoApz; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 25E1B9402AB X-Spam-Score: -0.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: e744lKwiDX/Y Eric Abrahamsen writes: > Kyle Meyer writes: > [...] >> Does it actually need a key binding? I've never used it and just use >> to move to the next field, leaving the field blank. > > I assume it's meant for blanking a field you've already typed something > into. But yes, I can't imagine it's a heavily-used command, and I > suspect the C-c binding is mostly mnemonic: "make this field > contain only blanks". [ Just for clarity: from this point on, the outer text you were quoting was from Tim Cross, not me. ] > I thought Emacs might have some easy way to let a key event "fall > through" to other keymaps, but I haven't been able to find anything > immediately obvious. Maybe I can ask on emacs.devel... Yeah, I don't know either. When I read your initial message, I assumed you were thinking of some sort of key lookup. Something like below seems to works, but it feels hacky and is probably pretty brittle. diff --git a/lisp/org-table.el b/lisp/org-table.el index ef4672e1b..c6d0e91c4 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1203,22 +1203,28 @@ (defun org-table-goto-line (N) (= cnt N))) ;;;###autoload -(defun org-table-blank-field () +(defun org-table-blank-field (&optional interactive-p) "Blank the current table field or active region." - (interactive) - (org-table-check-inside-data-field) - (if (and (called-interactively-p 'any) (org-region-active-p)) - (let (org-table-clip) - (org-table-cut-region (region-beginning) (region-end))) - (skip-chars-backward "^|") - (backward-char 1) - (if (looking-at "|[^|\n]+") - (let* ((pos (match-beginning 0)) - (match (match-string 0)) - (len (org-string-width match))) - (replace-match (concat "|" (make-string (1- len) ?\ ))) - (goto-char (+ 2 pos)) - (substring match 1))))) + (interactive "p") + (cond + ((org-at-table-p) + (org-table-check-inside-data-field) + (if (and interactive-p (org-region-active-p)) + (let (org-table-clip) + (org-table-cut-region (region-beginning) (region-end))) + (skip-chars-backward "^|") + (backward-char 1) + (if (looking-at "|[^|\n]+") + (let* ((pos (match-beginning 0)) + (match (match-string 0)) + (len (org-string-width match))) + (replace-match (concat "|" (make-string (1- len) ?\ ))) + (goto-char (+ 2 pos)) + (substring match 1))))) + (interactive-p + (let ((key (lookup-key (current-global-map) (this-command-keys)))) + (unless (numberp key) + (call-interactively key)))))) (defun org-table-get-field (&optional n replace) "Return the value of the field in column N of current row.