From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Adding git-commit highlight mode? Date: Thu, 02 Jan 2025 21:01:12 +0200 Message-ID: <86wmfdhwg7.fsf@gnu.org> References: <37733be4476e1c2b6e873c967c79cb0035959a9e.camel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31580"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Konstantin Kharlamov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 02 20:02:15 2025 Return-path: Envelope-to: ged-emacs-devel@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 1tTQSV-0007zp-5W for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Jan 2025 20:02:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTQRf-0003xS-7t; Thu, 02 Jan 2025 14:01:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTQRb-0003wj-0C for emacs-devel@gnu.org; Thu, 02 Jan 2025 14:01:19 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTQRZ-0004CW-E1; Thu, 02 Jan 2025 14:01:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zKpbXRATSDzUEqN1JN9N/f+Z18rOWYdyPRUiSeaHQac=; b=HYS+C5CqJxkkB0mKOxX0 cOlOHKmYwr9KVHzqYSWlxHAEuLysLxONE2SqnfWaqYlZkXYP1k9YfoQac8FfVmYKs41HWlEljB+GQ 2QRzWI8Z0Eckho5wbWCwwoOoftDmgUovTbafPP5vJh4mIaXRKmhn1fllP7j1bCtbUSbeDPnyEYPGO ZMW/VSIvgotkI7vAJMgajTfmbJxwZntMdCJK9r8FhNppYN0xcthxB8rtsbz1yP+8XbiJc02APSAGK zp9K8LLKavVR5gh1MoCEu5zH3GADGEvlZ2ZfVzR1LnSzScHwku/sA5v93zKOOmbHeLfMf8S3d9KBT /sFDFHN64MWpSw==; In-Reply-To: <37733be4476e1c2b6e873c967c79cb0035959a9e.camel@yandex.ru> (message from Konstantin Kharlamov on Thu, 02 Jan 2025 21:30:53 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327582 Archived-At: > From: Konstantin Kharlamov > Date: Thu, 02 Jan 2025 21:30:53 +0300 > > Hi, just wanted to ask this before potentially taking on the initiative > to only find the code will get rejected. > > I think a ballpark estimate of 90% of Git usage among CVSes in the > modern world is fair to assume. > > But Emacs seems to be the only widely popular editor that still doesn't > provide OOTB at least syntax highlight for git-commit format. So, does > anyone have opposition to adding a major mode that would be bound to > filenames like `COMMIT_EDITMSG` and others, and would provide the > aforementioned highlight? FWIW, I have this in my ~/.emacs since about forever: (define-derived-mode text-with-comments-mode text-mode "Text#" "Text mode with comment syntax." (setq-local comment-start "#") (setq-local comment-start-skip (concat (regexp-quote comment-start) "+\\s *")) (setq-local font-lock-defaults '(nil nil t nil)) (set-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?\# "<" table) table))) (add-to-list 'auto-mode-alist '("COMMIT_EDITMSG\\'" . text-with-comments-mode)) > If there's no opposition, I could write such mode (it seems to be a > simple one), but I don't promise anything because Idk how long this > discussion will go and what's gonna happen tomorrow, etc… I just had > some spare time and motivation today, so decided to at least start the > discussion. > > I don't have plans for adding complicated features besides just syntax > highlight. I think if anyone wishes they could be added later. And > indentation support from text-mode I think should be fine. Do you plan to make this mode be descendant of change-log-mode? something else?