From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Colouring a cell within a table Date: Mon, 19 Sep 2022 18:13:43 +0200 Message-ID: <87mtavbavc.fsf@dataswamp.org> References: <_RIolNjRicqtmZ5wXvQohcSz55X29e7seWZzaeofeaem-xa2J0_V5U7Vs715AYF7GrecbrcSSZNYxd3y9H5IwYnCU9H-xBcuLYhsBD_2t14=@proton.me> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20382"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:yQmMiPptWOIgNBCl5IfnNnunuyY= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 22 14:49:34 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obLdz-000515-Pp for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 22 Sep 2022 14:49:31 +0200 Original-Received: from localhost ([::1]:51330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obLdy-0004NM-8l for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 22 Sep 2022 08:49:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaJPA-0005Hu-Px for help-gnu-emacs@gnu.org; Mon, 19 Sep 2022 12:13:56 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:53830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaJP8-0004i8-TY for help-gnu-emacs@gnu.org; Mon, 19 Sep 2022 12:13:56 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1oaJP4-0002BB-R7 for help-gnu-emacs@gnu.org; Mon, 19 Sep 2022 18:13:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 22 Sep 2022 08:44:13 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139598 Archived-At: Yuri Khan wrote: >> Am looking for information to see how I can colour a cell >> within a table. Ideally I would like to have a keybinding >> so that when I an in a cell its background in changed to >> a different colour. > > Why do you want to do this? > > In general, coloring parts of a document in predefined > colors is a bad thing to want. Users with a different color > theme than yours will have trouble reading the document. > > A better direction is to define a major mode for your class > of documents, a few faces, and fontification rules that find > fragments your users would want colored and apply those > faces. The user will be able to customize the faces to > their liking. The Emacs mode already has support for font lock (AKA "syntax highlighting" outside the Emacs world) for the desired document type. If a different or more tivoli than that is desired, configure it or add new font lock rules with `font-lock-add-keywords', e.g. (font-lock-add-keywords 'emacs-lisp-mode '( ("`.*'" . font-lock-reference-face) ("font-lock-builtin-face" . font-lock-builtin-face) ("font-lock-comment-delimiter-face" . font-lock-comment-delimiter-face) ("font-lock-comment-face" . font-lock-comment-face) ("font-lock-constant-face" . font-lock-constant-face) ("font-lock-doc-face" . font-lock-doc-face) ("font-lock-function-name-face" . font-lock-function-name-face) ("font-lock-keyword-face" . font-lock-keyword-face) ("font-lock-negation-char-face" . font-lock-negation-char-face) ("font-lock-preprocessor-face" . font-lock-preprocessor-face) ("font-lock-reference-face" . font-lock-reference-face) ("font-lock-regexp-grouping-backslash" . 'font-lock-regexp-grouping-backslash) ("font-lock-regexp-grouping-construct" . 'font-lock-regexp-grouping-construct) ("font-lock-string-face" . font-lock-string-face) ("font-lock-type-face" . font-lock-type-face) ("font-lock-variable-name-face" . font-lock-variable-name-face) ("font-lock-warning-face" . font-lock-warning-face) ) t) Those faces are then, much like the Donald Trump supporters that stormed the Capitolium ... https://dataswamp.org/~incal/figures/emacs/dressed-up-as-themselves.png -- underground experts united https://dataswamp.org/~incal