unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Karl Fogel <kfogel@red-bean.com>
To: Emacs Development <emacs-devel@gnu.org>
Subject: [PATCH] Have LaTeX mode use normal double quotes in comments.
Date: Mon, 29 Aug 2016 14:44:12 -0500	[thread overview]
Message-ID: <87twe3icmr.fsf@red-bean.com> (raw)

(Probably everything I say here is true of TeX mode as well, but I've only been working in LaTeX mode.)

In LaTeX mode, typing a double quote (") runs `tex-insert-quote' in lisp/textmodes/tex-mode.el.  That function inserts `` or '' depending on whether you're opening or closing the quoted string.  However, when one is in a LaTeX comment, one usually doesn't want the fancy double quotes -- much more often, at least in my editing, one just wants normal double quotes.  Here's the contrast:

  % Comments begin with "%" and usually call for "normal" double quotes.
  Whereas for uncommented text, I always say ``The fancier the better!''

So, three questions:

* Any objections to the patch below?

* It seems weird to use "(nth 8 (save-excursion (syntax-ppss)))" to ask the question "Are we in a comment?"  I could further abstract that out into a helper function, just in tex-mode.el, since `tex-font-lock-verb' also does something similar and thus could call the helper too.

* My guess is most others would usually want normal double-quote in comments, but who knows, maybe users' default needs in this regard are more varied than I think.  Should this behavior be configurable?  I could certainly make it, and could leave the default as-is or switch the default.  Thoughts welcome.

I'm new to tex-mode.el, so wanted to check here on all the above issues before committing anything.

Best regards,
-Karl

index 710899f..816eedd 100644
--- lisp/textmodes/tex-mode.el
+++ lisp/textmodes/tex-mode.el
@@ -1311,6 +1311,8 @@ tex-insert-quote
   ;;
   (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\))
           (eq (get-text-property (point) 'face) 'tex-verbatim)
+          ;; If inside a comment, use normal double quotes:
+          (nth 8 (save-excursion (syntax-ppss)))
           ;; Discover if a preceding occurrence of `tex-open-quote'
           ;; should be morphed to a normal double quote.
           ;;



             reply	other threads:[~2016-08-29 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 19:44 Karl Fogel [this message]
2016-08-30  0:44 ` [PATCH] Have LaTeX mode use normal double quotes in comments Stefan Monnier
2016-08-30 17:04   ` Karl Fogel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twe3icmr.fsf@red-bean.com \
    --to=kfogel@red-bean.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).