From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kDlrIMnC9V/VKQAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 14:01:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EEw3HMnC9V9ObwAAbx9fmQ (envelope-from ) for ; Wed, 06 Jan 2021 14:01:45 +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 C974D94059B for ; Wed, 6 Jan 2021 14:01:44 +0000 (UTC) Received: from localhost ([::1]:49978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kx9Nf-0007YP-C9 for larch@yhetil.org; Wed, 06 Jan 2021 09:01:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kx82H-0007Gr-FW for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 07:35:33 -0500 Received: from mail-oln040092066104.outbound.protection.outlook.com ([40.92.66.104]:18861 helo=EUR01-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 1kx81y-00078I-VW for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 07:35:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=euSW9ZydfNUHJIrhoDqEDDcCcoAYYZQiyKsnIAMWVrVmpFXWKDrI/YhDJCRuSNv07WYlHtAdcGy9Uo8TH/ig9lbsKAdCl1q77zPwDi4MH+S3jF/EaKB8ISnEKSwQyZIWmdOnj/2xND4xDXDhxQSfgSE2mEsYzxwbmw0PlyTjc624jphJ/c+e5TqKHSW7Zj1nuF2s+r6Me9P5VffxZrRKAAsx+uOPKJOIE4Vd08VlkyglT38m9rmpu/VGZcHJERo6pvV0KR5+tgiug+s2ziG2LDeQPsIwmmVSC30q1/dOjyC2FQB6vhOL0EtNC3mqQrZ8AYM8QBBliW1as4LABhxBcg== 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=Oi0blcT4IuJpewi78jVsN/FGpFPtYSlTg6SBgtqecKg=; b=QNntJYne6Qed4XuVrFLSDLuD6Vq/TWWegZlVyOCqRZo9HaKkt8N0s1LdidRAQCNJH+LhNnLj5Y+TH8JPj7K0kBvh4G6yMNunr3Y/d+qCnXuitk+YGItvr8pITdTnKgHwpFxLSQU4iwbTMFMYML+X8UrSYiPA8fJyYGMSoT1JunnG1c6mIpxR+05rq+6FgPXBuWnuXLWKVmnfF5zYl4YpTSef9Eg2zODsqptSzqPj52FL4tMwjEV4IcOTA0fWKbp9DIqDJQ+GWAKO5mQfE+JAmXwKGdLJOTiiIEjK9tG8MsaQpzXj5h7QQtPOg36USEU19QgLvG2se8PkE5gRw5EDNA== 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=Oi0blcT4IuJpewi78jVsN/FGpFPtYSlTg6SBgtqecKg=; b=bCfFIsi9aBd8oOQuNJWIcu3dnYu2BfC6mQnUoy4BfY0HdwtBSL09GeqT90l3xU8QWP0x+jJFalA03kuJgacs/khqApJmOWdF4CxhgD3xWoR0nHskSppQt7yLyObCW4xmA5aIErSB+Ovj/KiHwhODbD86sOKZ5rZrKTCochGoOjY30tfLg3v8eRrBJzFt+Yd0qWmPYpDFUIlmhd+f+yPL8B1jpSxdz1m6pSVRFFo0OKfWy67yO9IyOUDQnQSRyuqaBQGScmDGwgBAC79tbMd817JGgwa8CBLEe2QqbXGIchgr8JmOQhBxheE8JBZDpgs12xF7hw9WZr67QY5VQVBZbg== Received: from VE1EUR01FT038.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::4f) by VE1EUR01HT192.eop-EUR01.prod.protection.outlook.com (2a01:111:e400:7e19::496) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Wed, 6 Jan 2021 12:20:05 +0000 Received: from AM0PR06MB6577.eurprd06.prod.outlook.com (2a01:111:e400:7e19::48) by VE1EUR01FT038.mail.protection.outlook.com (2a01:111:e400:7e19::274) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.24 via Frontend Transport; Wed, 6 Jan 2021 12:20:05 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:6213AB29B5E8892EF2BCDFBA217A0A6D2588541226CEB4388148FAE7A3E73A26; UpperCasedChecksum:83E523520C74FEB2150E69864ACE537BE603092E6A0758BDBB8FC494FD37336F; SizeAsReceived:7224; Count:43 Received: from AM0PR06MB6577.eurprd06.prod.outlook.com ([fe80::9487:8c7d:da00:4993]) by AM0PR06MB6577.eurprd06.prod.outlook.com ([fe80::9487:8c7d:da00:4993%7]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021 12:20:05 +0000 From: Arthur Miller To: emacs-orgmode@gnu.org Subject: Include org-pretty-table by Matus Goljer (Fuco1) in org-mode Date: Wed, 06 Jan 2021 13:20:04 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: multipart/mixed; boundary="=-=-=" X-TMN: [fEXQsGryI8lqUrAnUJG+eTQM4JmPTT3N] X-ClientProxiedBy: AS8PR04CA0173.eurprd04.prod.outlook.com (2603:10a6:20b:331::28) To AM0PR06MB6577.eurprd06.prod.outlook.com (2603:10a6:208:19a::23) X-Microsoft-Original-Message-ID: <87v9ca8dfv.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pascal.homepc (90.230.29.56) by AS8PR04CA0173.eurprd04.prod.outlook.com (2603:10a6:20b:331::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Wed, 6 Jan 2021 12:20:04 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 3d48a1f8-4810-463b-e51b-08d8b23d6660 X-MS-TrafficTypeDiagnostic: VE1EUR01HT192: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qmdnGJsOFq6UVdmFDEQ0Ht0Vz/Z7K5Il54ABvUVUtsRuHomiQLZd3P6dbmOzWFGL8lT8M3POsu9Pakv5enI//ek1eWgu3gzTmDTa85lFPQdTDsGlR34Zi2VZA8Hm0/0R7q9BS8xQAyg9C3jtFFl6TUwRYhmHf6htp0i2P9FycJMs53euDgDvGdOi62GMj8E+xNLco4f3AvBC8Ch47+0L4Pulkc9Um2kAfVVHAMrQ+rpv1NXNLfDKUbt0kDjtMjjYnyHUCOWmxDWcnmJkScQfejot/I2BgDck2PtYe22OK0g= X-MS-Exchange-AntiSpam-MessageData: MylRM41usm9M8EnHQkn3JGaTG5XrO4ouozWjXClFVjoQqz4fZyFplKooZmalGmE/MWaFEMUl1Kb3uTV/MsWdexvmTaBY7ywIVqlowgwAvDOYGeQ+rzMSmuK7qIf3iJQYTLKKvZc5d/aEjSNeEI64+Q== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2021 12:20:05.2952 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 3d48a1f8-4810-463b-e51b-08d8b23d6660 X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT038.eop-EUR01.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: VE1EUR01HT192 Received-SPF: pass client-ip=40.92.66.104; envelope-from=arthur.miller@live.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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-Mailman-Approved-At: Wed, 06 Jan 2021 08:59:58 -0500 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 X-Migadu-Spam-Score: -3.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b=bCfFIsi9; 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: C974D94059B X-Spam-Score: -3.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: efqkdzKqXqsy --=-=-= Content-Type: text/plain Hi guys, Can we get org-pretty-table into org-mode? https://github.com/Fuco1/org-pretty-table It replaces ascii chars with unicode box-drawing characters. It might be a bit rough around the edges, and Matus himself does not seem to be currently interested to work on, but it seems to work satisfying for me. I would like to have it in org-mode by default as a coplement to org-pretty-entities and inline images and links. Attached is the latest source for those who don't like to download themselves from Github. I am not sure if I am the best person to work on this; I am not very well acquainted with org-mode, but I can try to help as much as I can. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=org-pretty-table.el Content-Transfer-Encoding: quoted-printable ;;; org-pretty-table.el --- Replace org-table characters with box-drawing u= nicode glyphs. ;; Copyright (C) 2013 Matus Goljer ;; Author: Matus Goljer ;; Maintainer: Matus Goljer ;; Keywords: faces ;; Version: 0.0.1 ;; Created: 29th November 2013 ;; 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: ;; This replaces the characters - | and + in `org-mode' tables with ;; appropriate unicode box-drawing glyphs, see ;; http://en.wikipedia.org/wiki/Box-drawing_character ;;; Code: (defconst org-pretty-table-regexp (regexp-opt '("-" "+" "|"))) (defsubst org-pretty-table-is-empty-line () (memq (following-char) '(? 10 ?#))) (defun org-pretty-table-propertize-region (start end) "Replace org-table characters with box-drawing unicode glyphs between START and END. Used by jit-lock for dynamic highlighting." (save-excursion (goto-char start) (let (table-end) (while (re-search-forward org-pretty-table-regexp end t) ;; reached the end of the current table (if (and table-end (> (point) table-end)) (setq table-end nil)) ;; check if the current match is a table if we are not in a ;; table right now (unless (and (not table-end) (not (save-match-data (org-at-table-p)))) ;; get the end of the table if we found a new table, so we ;; don't have to check (org-at-table-p) again until then (unless table-end (save-match-data (setq table-end (org-table-end)))) =20 ;; determine the context of the character (let ((match (match-string 0))) (cond ((equal "-" match) (backward-char 1) (re-search-forward "-+") (put-text-property (match-beginning 0) (match-end 0) 'display= (make-string (- (match-end 0) (match-beginning 0)) ?=E2=94=80)) t) ((equal "|" match) (cond ((and (eq (following-char) ?-) (save-excursion (forward-line 1) (not (org-pretty-table-is-empty-line))) (save-excursion (forward-line -1) (not (org-pretty-table-is-empty-line)))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=9C") t) ((and (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (forward-line 1) (not (org-pretty-table-is-empty-line))) (save-excursion (forward-line -1) (not (org-pretty-table-is-empty-line)))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=A4") t) ((and (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (forward-line -1) (org-pretty-table-is-empty-line))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=90") t) ((and (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (forward-line 1) (org-pretty-table-is-empty-line))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=98") t) ((and (eq (following-char) ?-) (save-excursion (forward-line -1) (org-pretty-table-is-empty-line))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=8C") t) ((and (eq (following-char) ?-) (save-excursion (forward-line 1) (org-pretty-table-is-empty-line))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=94") t) (t (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=82") t))) ((equal "+" match) (cond ((and (eq (following-char) ?-) (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (let ((char-pos (- (point) (line-beginning-position)= 1))) (forward-line -1) (beginning-of-line) (forward-char char-pos)) (eq (following-char) ?|)) (save-excursion (backward-char 1) (next-line) (eq (following-char) ?|))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=BC") t) ((and (eq (following-char) ?-) (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (backward-char 1) (previous-line) (memq (following-char) '(? 10))) (save-excursion (let ((char-pos (- (point) (line-beginning-position)= 1))) (forward-line 1) (beginning-of-line) (forward-char char-pos)) (eq (following-char) ?|))) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=AC") t) ((and (eq (following-char) ?-) (save-excursion (backward-char 1) (eq (preceding-char) ?-)) (save-excursion (let ((char-pos (- (point) (line-beginning-position)= 1))) (forward-line -1) (beginning-of-line) (forward-char char-pos)) (eq (following-char) ?|)) (save-excursion (backward-char 1) (next-line) (or (memq (following-char) '(? 10)) (eq (char-after (line-beginning-position)) ?#)))= ) (put-text-property (match-beginning 0) (match-end 0) 'displ= ay "=E2=94=B4") t)))))))))) (defun org-pretty-table-unpropertize-region (start end) "Remove box-drawing compositions between START and END." (remove-text-properties start end '(display))) ;;; Minor mode: ;;;###autoload (define-minor-mode org-pretty-table-mode "Replace org-table characters with box-drawing unicode glyphs." :lighter " OPT" (if org-pretty-table-mode (jit-lock-register 'org-pretty-table-propertize-region t) (jit-lock-unregister 'org-pretty-table-propertize-region) (org-pretty-table-unpropertize-region (point-min) (point-max)))) ;;;###autoload (defun turn-on-org-pretty-table-mode () (org-pretty-table-mode 1)) ;;;###autoload (defun turn-off-org-pretty-table-mode () (org-pretty-table-mode 0)) ;;;###autoload (define-globalized-minor-mode global-org-pretty-table-mode org-pretty-table-mode turn-on-org-pretty-table-mode) (provide 'org-pretty-table) ;;; org-pretty-table.el ends here --=-=-=--