From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Sebastian Urban Newsgroups: gmane.emacs.bugs Subject: bug#36358: Indentation of not matched braces in latex-mode Date: Tue, 25 Jun 2019 09:30:35 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="39928"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 Cc: 36358@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 09:31:43 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hffvZ-000ACo-TH for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 09:31:42 +0200 Original-Received: from localhost ([::1]:57214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hffvX-00074D-ED for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 03:31:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37791) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hffv4-000742-6U for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 03:31:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hffv0-0002TM-Ba for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 03:31:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45017) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hffuw-0002RH-9C for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 03:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hffuw-000638-3U for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 03:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sebastian Urban Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2019 07:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36358 X-GNU-PR-Package: emacs Original-Received: via spool by 36358-submit@debbugs.gnu.org id=B36358.156144784323229 (code B ref 36358); Tue, 25 Jun 2019 07:31:02 +0000 Original-Received: (at 36358) by debbugs.gnu.org; 25 Jun 2019 07:30:43 +0000 Original-Received: from localhost ([127.0.0.1]:58561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hffud-00062a-Cp for submit@debbugs.gnu.org; Tue, 25 Jun 2019 03:30:43 -0400 Original-Received: from mail-lj1-f178.google.com ([209.85.208.178]:32829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hffub-00062O-KZ for 36358@debbugs.gnu.org; Tue, 25 Jun 2019 03:30:42 -0400 Original-Received: by mail-lj1-f178.google.com with SMTP id h10so15200752ljg.0 for <36358@debbugs.gnu.org>; Tue, 25 Jun 2019 00:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zvvSxCGBlCg5+tD8VzIv8EelEI7Uvb7Y29vz8zSkIbE=; b=C7KNffyC/Uqcs5FnqbbbgkmvFW3hlQlOlvrnPiEnWscz5L2QVu+DwcIsMow0WlOwOp PkZnwu4RQF/ncuhwMNOxI0iIq0UAAyW2z29yHE6fFGVKm5Afw3SRbBm5DHjemsmVY9dX 6LiKrLSoLeiuQpziLuQAYuckpv6v6pXQ5M6C+g7mF6e4Qyaa81TE14bxcNUJ7p4Up9YF IDTJv3R+cU+wRvk+QoownLGOyK9lxgJlwrr/wj5T8N1NPH14QKakKyle7HQeejM+aDnv 9J9KDXjdpK9gvakaNRNFEDvQRZNTfmsJLRAskxzyGEhaNb6kU5RZsmPyClSUlP8DHbLD jFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zvvSxCGBlCg5+tD8VzIv8EelEI7Uvb7Y29vz8zSkIbE=; b=e3bpMaq5tWP0IpsAURYyTQudOmC5Ga4hFhlv4Oz+ShY1hUS7j7LHAuEJlRjOhVaz/t Ko10zS+RwZPTD6iNBExBynktKxuq+LqugfdCUwpvh6vmPvYNbbmEcJhRkb2Q3JwJZKlt DmKt1m4/eyP5r0NtrUHlvpdcL8DEfFo4K8UCVNihwgdqaA/9x+NZYmnne36Bsv3TvsWY SgxorbqvfOE2j9ZSeBDztc6aiXNEO+F7E6Q+nJ7neGWMyrETSUReRT8piEvKU/YY/9w4 FBeehiUZoOFlLfWPRy+5UiLWvdbyvvy/SWTnSKdhiLoUgiVBfao2lF2u2EWfVj58Dsr9 kkkg== X-Gm-Message-State: APjAAAULk3jcChu/C3F2jSZUDHwJsJxRhus9WrsJNwvaMdwapP30VDRi iwz6DQjDejiwHoUEajB3Sxn2X54iDAs= X-Google-Smtp-Source: APXvYqzeqqcp7s/7zivfwr/ZVMBfeIOlVWSu/qpQOLPJlPBhJOFbIwspU6GWWQm6ccXiTQvofZ5gMA== X-Received: by 2002:a2e:9b4a:: with SMTP id o10mr485737ljj.137.1561447835088; Tue, 25 Jun 2019 00:30:35 -0700 (PDT) Original-Received: from [89.161.9.216] (ip-89-161-9-216.tel.tkb.net.pl. [89.161.9.216]) by smtp.gmail.com with ESMTPSA id g5sm2118857ljj.69.2019.06.25.00.30.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 00:30:34 -0700 (PDT) In-Reply-To: Content-Language: en-GB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161327 Archived-At: > I just pushed the patch below which lets you specify commands whose > args shouldn't be indented this way. Hmmm... or I don't understand how "specify commands whose args shouldn't be indented" will work in practice, or this may be wrong path. It's not about \emph{} or \footnote{}, it's about every command which use '{}' (braces), so in latex... most of them(?). Therefore if you let people add them to the list it'll grow really big - just look at font styles: \textrm{}, \textit{}, \textmd{}, \textbf{}, \textup{}, \textsl{}, \textsf{}, \textsc{}, \texttt{}, \textnormal{} - we could probably use "\text*", but there are other commands, for example the ones we define as new in preamble. Unless this patch is temporary lifebuoy for those who don't want to set 'tex-indent-basic' to 0, then well... carry on. :) > Note that the patch is for Emacs's bundled tex-mode, whereas you > seem to be using AUCTeX, which uses its own indentation code. No, I'm _not_ using AUCTeX, I'm using latex-mode. I only pointed to AUCTeX, because when I was looking for answer to this problem, I found solution (helpful internet) in AUCTeX - 'TeX-brace-indent-level' variable - and wanted something similar in latex-mode. Also I found code in theirs (AUCTeX) TEX.EL, which may help a bit. It may, but since I basically know no Elisp, I may be wrong. (defcustom TeX-brace-indent-level 2 "*The level of indentation produced by an open brace." :group 'TeX-indentation :type 'integer) (defun TeX-brace-count-line () "Count number of open/closed braces." (save-excursion (let ((count 0) (limit (line-end-position)) char) (while (progn (skip-chars-forward "^{}\\\\" limit) (when (and (< (point) limit) (not (TeX-in-comment))) (setq char (char-after)) (forward-char) (cond ((eq char ?\{) (setq count (+ count TeX-brace-indent-level))) ((eq char ?\}) (setq count (- count TeX-brace-indent-level))) ((eq char ?\\) (when (< (point) limit) (forward-char) t)))))) count))) This variable is also used in theirs LATEX.EL - L3366, L3503. Both functions too big to paste, I think.