* [PATCH] Have LaTeX mode use normal double quotes in comments.
@ 2016-08-29 19:44 Karl Fogel
2016-08-30 0:44 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Karl Fogel @ 2016-08-29 19:44 UTC (permalink / raw)
To: Emacs Development
(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.
;;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Have LaTeX mode use normal double quotes in comments.
2016-08-29 19:44 [PATCH] Have LaTeX mode use normal double quotes in comments Karl Fogel
@ 2016-08-30 0:44 ` Stefan Monnier
2016-08-30 17:04 ` Karl Fogel
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2016-08-30 0:44 UTC (permalink / raw)
To: emacs-devel
> * Any objections to the patch below?
Sounds good to me (I've had the same desire but never got around to
writing the patch).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Have LaTeX mode use normal double quotes in comments.
2016-08-30 0:44 ` Stefan Monnier
@ 2016-08-30 17:04 ` Karl Fogel
0 siblings, 0 replies; 3+ messages in thread
From: Karl Fogel @ 2016-08-30 17:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>Sounds good to me (I've had the same desire but never got around to
>writing the patch).
Done: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2b404e8391b7ac26b734710d8290a6ef6a2e32b1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-30 17:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-29 19:44 [PATCH] Have LaTeX mode use normal double quotes in comments Karl Fogel
2016-08-30 0:44 ` Stefan Monnier
2016-08-30 17:04 ` Karl Fogel
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.