all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Michalis V." <mvar.40k@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: mvar <mvar.40k@gmail.com>, 39134@debbugs.gnu.org
Subject: bug#39134: 28.0.50; forward-sexp fails on curved singlequotes
Date: Tue, 17 Aug 2021 12:58:46 +0300	[thread overview]
Message-ID: <87sfz8wfxl.fsf@cnu407c2zx.nsn-intra.net> (raw)
In-Reply-To: <3acc81de-6603-1f73-5086-a2f9fcc0e874@easy-emacs.de> ("Andreas Röhler"'s message of "Mon, 16 Aug 2021 17:39:32 +0200")

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
> Hi Michalis,
>
> don't have any idea WRT importance of this.
>
> Just thought it may work  - modifying the help-mode syntax-table should do it.
>
> Best,
>
> Andreas

hi Andreas,

Looking at the help-mode.el it wasn't very clear to me how the help-mode
syntax-table variable was actually created - there wasn't any defvar
defined but rather the syntax-table was applied inside two
defuns. Despite that "C-h v help-mode-syntax-table" would redirect 
to this line in help-mode.el

(define-derived-mode help-mode special-mode "Help"

for some cryptic reason. Anyway attached is a patch that introduces
properly the help-mode-syntax-table var which derives from the elisp one
and sets ‘’ as parens. Now forward-sexp jumps over the definitions in
the *Help* buffer as it should despite any punctuation they may contain. 

cheers,
Michalis


[-- Attachment #2: help-mode.diff --]
[-- Type: text/x-patch, Size: 1527 bytes --]

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 2f82d83ceb..6280fad1c1 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -111,6 +111,15 @@ help-xref-stack-forward-item
 (setq-default help-xref-stack nil help-xref-stack-item nil)
 (setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil)
 
+(defvar help-mode-syntax-table
+  (let ((table (make-syntax-table emacs-lisp-mode-syntax-table)))
+    ;; treat single quotes as parens so that forward-sexp does not
+    ;; break when quoted string contains punctuation
+    (modify-syntax-entry ?‘ "(’  " table)
+    (modify-syntax-entry ?’ ")‘  " table)
+    table)
+  "Syntax table used in `help-mode'.")
+
 (defcustom help-mode-hook nil
   "Hook run by `help-mode'."
   :type 'hook
@@ -490,7 +499,7 @@ help-make-xrefs
         (let ((stab (syntax-table))
               (case-fold-search t)
               (inhibit-read-only t))
-          (set-syntax-table emacs-lisp-mode-syntax-table)
+          (set-syntax-table help-mode-syntax-table)
           ;; The following should probably be abstracted out.
           (unwind-protect
               (progn
@@ -643,7 +652,7 @@ help-insert-xref-button
 (defun help-xref-on-pp (from to)
   "Add xrefs for symbols in `pp's output between FROM and TO."
   (if (> (- to from) 5000) nil
-    (with-syntax-table emacs-lisp-mode-syntax-table
+    (with-syntax-table help-mode-syntax-table
       (save-excursion
 	(save-restriction
 	  (narrow-to-region from to)

  reply	other threads:[~2021-08-17  9:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 13:35 bug#39134: 28.0.50; forward-sexp fails on curved singlequotes Andreas Röhler
2020-01-14 15:29 ` Eli Zaretskii
2020-01-14 16:06   ` Andreas Röhler
2020-01-14 16:20     ` Eli Zaretskii
2020-01-14 17:33       ` Andreas Röhler
2021-08-16  6:20 ` mvar
2021-08-16 15:39   ` Andreas Röhler
2021-08-17  9:58     ` Michalis V. [this message]
2021-08-17 12:21       ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=87sfz8wfxl.fsf@cnu407c2zx.nsn-intra.net \
    --to=mvar.40k@gmail.com \
    --cc=39134@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    /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 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.