From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gKkeOkOjj2Df9wAAgWs5BA (envelope-from ) for ; Mon, 03 May 2021 09:16:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id wAqvNUOjj2BREQAAbx9fmQ (envelope-from ) for ; Mon, 03 May 2021 07:16:19 +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 1CD5D12AF4 for ; Mon, 3 May 2021 09:16:19 +0200 (CEST) Received: from localhost ([::1]:47282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldSoT-0004EH-37 for larch@yhetil.org; Mon, 03 May 2021 03:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldSo1-0004EB-2h for emacs-orgmode@gnu.org; Mon, 03 May 2021 03:15:49 -0400 Received: from mail-oln040092072036.outbound.protection.outlook.com ([40.92.72.36]:6156 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldSny-00017t-Kg for emacs-orgmode@gnu.org; Mon, 03 May 2021 03:15:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ol3hySY6FyYY58mUK/BSV/4ndpWPVqnatspWvZkBdcC6K/v7yzugp2QaPK8dhVXTTiJFYoYUAfkaQ/ZZV3iVDHnFvN4WIarmuUgPqBMuOx3MLqyfobisOqqZN4227kKMLrXEoaRHCvcCc9HFIqxXHuLUWG5R35TT3j4UfRX5A9WUU4WKUq49pv7cbPLqzJoQEa934ouwWv/sThCGuciiBn4Prz/LWvRgBBWe5GH1I1nc3vcpW9SazOzKw+oslZ+mNibupmesm+jGS4pU0JruQ7rEH6CV1R8u1HOtcvtZ0GyS8xFy6AenQfiQhUksGLsV/Rn2yWUh03YyTFhp3QSlcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7P+HqS/IxCH02sV3sVdPwxIL2c56m2aRs5pFGjfcAdo=; b=jx8I/djw8pTkZdhANfOCaKzSQHkFNgTZfXsh5l6gyVnBuW7dXsBQaqczC6hb1oPIkUs6/cGE4YQLrOpVbzI9PaMmArNtSzDfjp3MBlELlv+VYVe6Bfn/YQewzhX6WoOgYWp4Nd6A4I/ApjkaRsbcL7K2yk0TJBgQuMXlJqYIMUtEGESO3k5TKRCCty2nBkqS9xKseyiE0wCkwb1t+kOGF3qgg45pgiIJ0u0MGWLe6TA2ZfLAJ4KU3HzYu0xTndOkp39UFGwtewLj67Q81OQlV0atj4bqJjRFzZznMPJUuZiWyHboObgjerLsYd+hoKJy+5An0MI5HfXco4VrzaXNuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7P+HqS/IxCH02sV3sVdPwxIL2c56m2aRs5pFGjfcAdo=; b=fns2qebYbkk/bO8lQAvoHJtgLb2JHTtI30dPDC4yZIJ2prGct5AXAb+Vn0SNIefCktY5ZaE8nsZK1VakRwcBMFclpu8mMnZpPcWlXC9U4NePEibnBpMxPPTYQ/geMbHcKLrGgekN40ewGDZAiEInX6BY7ZTmAjNO5W1oS4AnT/u1/pK9TP1S2O9Pv4osZJCR2oBqG3ljEO+CP/dPYtgjJsWTtAGPmdueuemPwOneeUh+H28G4AIfAF4o7MT822qknz69f/cNnD2+Z+NXqMt9rCbMhysHAxexSeQorvXKHYYcjpv3WU92As+Ul023VvVGgC6wTXIlEtqz9m1EQnh9IA== Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e08::45) by AM5EUR03HT085.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e08::411) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27; Mon, 3 May 2021 07:00:41 +0000 Received: from DB9PR09MB4986.eurprd09.prod.outlook.com (2a01:111:e400:7e08::50) by AM5EUR03FT059.mail.protection.outlook.com (2a01:111:e400:7e08::449) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Mon, 3 May 2021 07:00:41 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:02F6BA94958FAD164949B7AB5ADA75E0020B9A26D68ECC5CCC38E02ADE87E460; UpperCasedChecksum:226C0E15D12FFACFE22510185D9E96751E8D1FBC0857AB55F07D10D0FDC11EEA; SizeAsReceived:7186; Count:43 Received: from DB9PR09MB4986.eurprd09.prod.outlook.com ([fe80::8199:d67e:e470:b73e]) by DB9PR09MB4986.eurprd09.prod.outlook.com ([fe80::8199:d67e:e470:b73e%7]) with mapi id 15.20.4087.044; Mon, 3 May 2021 07:00:41 +0000 From: Arthur Miller To: emacs-orgmode@gnu.org Subject: Checkboxes in headings - opinions wanted Date: Mon, 03 May 2021 09:00:40 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [kjFKPFcayis0L2A8fDtVfYjOmp7jip2/] X-ClientProxiedBy: BE0P281CA0019.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:14::6) To DB9PR09MB4986.eurprd09.prod.outlook.com (2603:10a6:10:2a9::19) X-Microsoft-Original-Message-ID: <824kfkwbc7.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from HP-Laptop.homepc (81.232.177.30) by BE0P281CA0019.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:14::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.8 via Frontend Transport; Mon, 3 May 2021 07:00:40 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: be9b1dbd-c27b-4da1-9db4-08d90e0129da X-MS-TrafficTypeDiagnostic: AM5EUR03HT085: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WLcAhkzqV0z7UNX+uSSLeCszx3qrcBbU2IlF/ZB0DmxWZ6vhRUIzABrSZd/3ImLVqWjvP88ARwK4XjuAE/4NUYJFVGa5dxNk/oCBLPbyy20AGb+Ja7nP7AOp2lUF39prWMl5RpUVbeiCEtGTu/nRyDOFwdwK/kFhmP9qlkGRF9IDKP7irHU5MtwG9Ijot0GD3V7I9iOpwEGpjftVKCvCwbytUu6GBI70YUTqqiGzLgT/pt2d4xbIbgbNh6XbxkPqHUxGC/vrzQkPVPcHN/Cg0PoCb2uIg01tvq4gX2njgKl7Xf5IMPFWz1yOSAoSp3R6YLORMWn2nPreXQ0ImhOntKbQreLZQm8utCJmsB3zTBoBV7HU51iTSbKJRmGrnGp5qmcCAQpaiz/LEbnu0Kp0/Q/zvGekIiLhbqa2w4tVwf+dcgIWwmL2HIG1DG9XRPFJ X-MS-Exchange-AntiSpam-MessageData: fDvZEJrx8yRnSUQnMcjF4eQBDhWD0GZCRs652zVgssC4Gm1RyDlNcymYXcELshOO8ZP6vb4g68cQANOHuYlPiTZpgWvbPYRHw7Rt4L3KZFxgR9aGcvLc82tszgU25w1cgZz/aV5ZK869CpKM9cI29A== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: be9b1dbd-c27b-4da1-9db4-08d90e0129da X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2021 07:00:41.5558 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR03HT085 Received-SPF: pass client-ip=40.92.72.36; envelope-from=arthur.miller@live.com; helo=EUR03-VE1-obe.outbound.protection.outlook.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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620026179; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7P+HqS/IxCH02sV3sVdPwxIL2c56m2aRs5pFGjfcAdo=; b=XkKRWFoWISJaZGTrV8k7YQpMKAiWMjL435//VH2xGULz3A+M9TyNl780c6ShDxdC9EjPDL 4iagP+WQelFit8Z5RWGyUzJ7C0f7ro5iBb9ltleuFV2//rJZkeMdBEHAvg88hI0oVsc74I vACdHYeQ6NABNOqxz5dngzCiD/xzJUoVn4GDgnYlS06o1+C3P7T43+9pdhzapAPbuXQK9F L46tkmiUM2Ra5BIbdEgpwRFiXZikeMdeuWgtGXoYzw0ZwGQRifkA5bFvmruF7FBEiRaB5j uCdFZeZqdQyzQ1BaS75T9squCYQnBdwP4K0wZniRINPkUfpiZiC1qff3BUWH4Q== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1620026179; a=rsa-sha256; cv=pass; b=oXAbAtqtpbyIsXko5SVcNYQs02J4OUIkDUK1kIDVRE5aiMr/rnVvNdwQRwRyGPxl6WEFOG ZkGnA3JPjrEhUFawNpCg7INf1I19ldUMRpojsO13Pjs3ptq8mwTlSLN7J5XwA27f4+voFB EgbZmmK7utql7/qnBLvssryb52p7EMTw0Sf96NlguIN2e3vOuHkqb0rA3P2XVD88wVKRIx /nwaOj7voLR+w3AqeRR8ptmSULT4RidzXQVM9uEapdzSCLFKhqH/De2qo4skEB+2DQAH5D NE3MRQtYeqqG29eIHrJmfofRPvGbyUgAP98jRQyamPQdPcRnHfhTFOSugxx6NA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=fns2qebY; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.com; 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-Spam-Score: -4.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=fns2qebY; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.com; 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: 1CD5D12AF4 X-Spam-Score: -4.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: XeeFPXSWlPJ+ --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-heading-checkbox.el Content-Transfer-Encoding: quoted-printable ;;; org-heading-checkbox.el --- A minor mode to fake checkboxes in org-head= ings. -*- lexical-binding: t; -*- ;; Copyright (C) 2021 Arthur Miller ;; Author: Arthur Miller ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;=20 ;;; Code: (defvar ohc--enabled-re "^[ \t]*\\*+.*?[ \t]*\\[x\\]") (defvar ohc--disabled-re "^[ \t]*\\*+.*?[ \t]*\\[ \\]") (defvar ohc--checkbox-re "^[ \t]*\\*+.*?\\[[ x]\\]") (defvar org-heading-checkbox-enabled-hooks nil) (defvar org-heading-checkbox-disabled-hooks nil) (defvar ohc--mode-on nil) (defun ohc--mode-on () (setq ohc--mode-on t)) (defun ohc--mode-off () (setq ohc--mode-on nil)) (defun ohc--heading-checkbox-p () "Return t if this is a heading with a checkbox." (save-excursion (beginning-of-line) (looking-at ohc--checkbox-re))) (defun ohc--checkbox-enabled-p () "Return t if point is at a heading with an enabed checkbox." (save-excursion (beginning-of-line) (looking-at "^[ \t]*\\*+.*?\\[x\\]"))) (defun ohc--checkbox-disabled-p () "Return t if point is at a heading with a disabeled checkbox." (save-excursion (beginning-of-line) (looking-at "^[ \t]*\\*+.*?\\[ \\]"))) (defun ohc--checkbox-enable () "Disable checkbox for heading at point." (interactive) (when (ohc--checkbox-enabled-p) (save-excursion (beginning-of-line) (replace-string "[ ]" "[x]" nil (line-beginning-position) (line-end-position)) (run-hooks 'org-heading-checkbox-enabled-hooks)))) (defun ohc--checkbox-disable () "Disable checkbox for heading at point." (interactive) (when (ohc--checkbox-enabled-p) (save-excursion (beginning-of-line) (replace-string "[x]" "[ ]" nil (line-beginning-position) (line-end-position)) (run-hooks 'org-heading-disabled-hooks)))) (defun ohc--checkbox-toggle () "Toggle state of checkbox at heading under the point." (interactive) (save-excursion (beginning-of-line) (cond ((looking-at ohc--enabled-re) (replace-string "[x]" "[ ]" nil (line-beginning-position) (line-end-position)) (run-hooks 'org-heading-checkbox-disabled-hooks)) ((looking-at ohc--disabled-re) (replace-string "[ ]" "[x]" nil (line-beginning-position) (line-end-position)) (run-hooks 'org-heading-checkbox-enabled-hooks)) (t (error "Not at org-heading-checkbox line."))))) (defun ohc--shiftup () (interactive) (if (ohc--heading-checkbox-p) (ohc--checkbox-toggle) (org-shiftup))) (defun ohc--shiftdown () (interactive) (if (ohc--heading-checkbox-p) (ohc--checkbox-toggle) (org-shiftdown))) (defvar org-heading-checkbox-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap org-shiftup] #'ohc--shiftup) (define-key map [remap org-shiftdown] #'ohc--shiftdown) map) "Keymap used in `org-init-mode'.") ;;;###autoload (define-minor-mode org-heading-checkbox-mode "" :global nil :lighter nil (unless (derived-mode-p 'org-mode) (error "Not in org-mode.")) (cond (org-heading-checkbox-mode (ohc--mode-on)) (t (ohc--mode-off)))) (defun test-hook () (message "A HOOK IS RUN")) (provide 'org-heading-checkbox) ;;; org-heading-checkbox.el ends here --=-=-= Content-Type: text/plain Last night I have been playing with a minor mode to enable a checkbox in a heading, or rather to fake a checkbox. To be honest, it was a 10 minute job. Took me way moare time to figure out avialable key combination to use (which I didn't found). In general, enable mode and use S+up/down to toggle a checkbox. A heading with a checkbox is of form [ \t]*\\*+.*? followed by a [ ] or [x] before a heading. It means a [ ] can be placed somewhere after the leading stars, whitespaces ignored. This has nothing todo with my previous hacks of todo keywords. This one does not uses todo states at all so it can be used with todo states. It is just a small prototype. I will use something else than replace-string later on. Just wonder if the approach is sane. There is also a repo on gh for interested one: https://github.com/amno1/org-heading-checkbox --=-=-=--