GNU bug report logs - #56630
(yasnippet) how to disable TAB <tab> C-i?

Previous Next

Package: emacs;

Reported by: edgar <at> openmail.cc

Date: Mon, 18 Jul 2022 15:31:01 UTC

Severity: normal

To reply to this bug, email your comments to 56630 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Mon, 18 Jul 2022 15:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to edgar <at> openmail.cc:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Jul 2022 15:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: edgar <at> openmail.cc
To: bug-gnu-emacs <at> gnu.org
Subject: (yasnippet) how to disable TAB <tab> C-i?
Date: Mon, 18 Jul 2022 15:29:37 +0000
Hello,

as per: https://github.com/joaotavora/yasnippet, I am sending an e-mail 
to you to ask for help.

I really like yasnippets, because it makes my workflow more productive, 
but I have not been able to disable the autocompletion with the TAB key:

* What I have tried
(use-package yasnippet :defer t :commands (yas-minor-mode)
  :bind
  (:map
   yas-minor-mode-map
   ("TAB" . nil)
   ("<tab>" . nil)
   ;; Expand with C-c m
   ;; (how?? yas--direct-{keymaps,org-mode})
   ("C-c m". yas-expand)
   ;; Change C-S-i to navigate back
   ("ESC TAB" . yas-prev-field)
   :map
   esc-map
    ;; Disable this to enable C-S-i to navigate back
    ;; (previously defined in bindings.el)
    ("\t" . nil)))

(with-eval-after-load 'yasnippet
  (setq yas-snippet-dirs (list "~/snippets/"))
  (yas--load-snippet-dirs)
  ;; allow to insert a snippet within a snippet
  (setq yas-triggers-in-field t)
  ;; Testing (above)
  ;; ;; Change trigger key
  ;; (define-key yas-minor-mode-map (kbd "C-i") nil)
  ;; (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
  ;; (define-key yas-minor-mode-map [(tab)]        nil)
  ;; (define-key yas-minor-mode-map (kbd "TAB")    nil)
  ;; (define-key yas-minor-mode-map (kbd "<tab>")  nil)
  )

* Current behaviour
1. I launch a snippet with C-c m
2. Inside, I type the name of another snippet, for clarity, assume it is 
tuk
3. I type [TAB], C-i
4. tuk gets expandedtuk

* Expected behaviour
1. I launch a snippet with C-c m
2. Inside, I type the name of another snippet, for clarity, assume it is 
tuk
3. I type [TAB], C-i
4. I get out of ttukhe first snippet (tuk does not get expanded).

tuk is this:
# -*- mode: snippet -*-
# name: latex-inline
# key: tuk
# expand-env: ((yas-indent-line 'fixed))
# --
\\($1\\)$0

How do I configure yasnippet so that snippets get expended with C-c m 
*only*? Thanks!

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse <at> vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Mon, 18 Jul 2022 15:34:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: edgar <at> openmail.cc
To: bug-gnu-emacs <at> gnu.org
Subject: Re: (yasnippet) how to disable TAB <tab> C-i?
Date: Mon, 18 Jul 2022 15:32:41 +0000
Of course:
- yasnippet-snippets             20220401.1534   
c5bf4c4085aa61b9c07563de89f7aacc2a357db5
- GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6) of 2022-04-28

On 2022-07-18 15:29, edgar <at> openmail.cc wrote:
> Hello,
> 
> as per: https://github.com/joaotavora/yasnippet, I am sending an
> e-mail to you to ask for help.
> 
> I really like yasnippets, because it makes my workflow more
> productive, but I have not been able to disable the autocompletion
> with the TAB key:
> 
> * What I have tried
> (use-package yasnippet :defer t :commands (yas-minor-mode)
>   :bind
>   (:map
>    yas-minor-mode-map
>    ("TAB" . nil)
>    ("<tab>" . nil)
>    ;; Expand with C-c m
>    ;; (how?? yas--direct-{keymaps,org-mode})
>    ("C-c m". yas-expand)
>    ;; Change C-S-i to navigate back
>    ("ESC TAB" . yas-prev-field)
>    :map
>    esc-map
>     ;; Disable this to enable C-S-i to navigate back
>     ;; (previously defined in bindings.el)
>     ("\t" . nil)))
> 
> (with-eval-after-load 'yasnippet
>   (setq yas-snippet-dirs (list "~/snippets/"))
>   (yas--load-snippet-dirs)
>   ;; allow to insert a snippet within a snippet
>   (setq yas-triggers-in-field t)
>   ;; Testing (above)
>   ;; ;; Change trigger key
>   ;; (define-key yas-minor-mode-map (kbd "C-i") nil)
>   ;; (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
>   ;; (define-key yas-minor-mode-map [(tab)]        nil)
>   ;; (define-key yas-minor-mode-map (kbd "TAB")    nil)
>   ;; (define-key yas-minor-mode-map (kbd "<tab>")  nil)
>   )
> 
> * Current behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. tuk gets expandedtuk
> 
> * Expected behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. I get out of ttukhe first snippet (tuk does not get expanded).
> 
> tuk is this:
> # -*- mode: snippet -*-
> # name: latex-inline
> # key: tuk
> # expand-env: ((yas-indent-line 'fixed))
> # --
> \\($1\\)$0
> 
> How do I configure yasnippet so that snippets get expended with C-c m
> *only*? Thanks!

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse <at> vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Mon, 18 Jul 2022 15:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: edgar <at> openmail.cc
To: 56630 <at> debbugs.gnu.org
Subject: Fwd: Re: (yasnippet) how to disable TAB <tab> C-i?
Date: Mon, 18 Jul 2022 15:34:00 +0000

-------- Original Message --------
Subject: Re: (yasnippet) how to disable TAB <tab> C-i?
Date: 2022-07-18 15:32
From: edgar <at> openmail.cc
To: bug-gnu-emacs <at> gnu.org

Of course:
- yasnippet-snippets             20220401.1534   
c5bf4c4085aa61b9c07563de89f7aacc2a357db5
- GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6) of 2022-04-28

On 2022-07-18 15:29, edgar <at> openmail.cc wrote:
> Hello,
> 
> as per: https://github.com/joaotavora/yasnippet, I am sending an
> e-mail to you to ask for help.
> 
> I really like yasnippets, because it makes my workflow more
> productive, but I have not been able to disable the autocompletion
> with the TAB key:
> 
> * What I have tried
> (use-package yasnippet :defer t :commands (yas-minor-mode)
>   :bind
>   (:map
>    yas-minor-mode-map
>    ("TAB" . nil)
>    ("<tab>" . nil)
>    ;; Expand with C-c m
>    ;; (how?? yas--direct-{keymaps,org-mode})
>    ("C-c m". yas-expand)
>    ;; Change C-S-i to navigate back
>    ("ESC TAB" . yas-prev-field)
>    :map
>    esc-map
>     ;; Disable this to enable C-S-i to navigate back
>     ;; (previously defined in bindings.el)
>     ("\t" . nil)))
> 
> (with-eval-after-load 'yasnippet
>   (setq yas-snippet-dirs (list "~/snippets/"))
>   (yas--load-snippet-dirs)
>   ;; allow to insert a snippet within a snippet
>   (setq yas-triggers-in-field t)
>   ;; Testing (above)
>   ;; ;; Change trigger key
>   ;; (define-key yas-minor-mode-map (kbd "C-i") nil)
>   ;; (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
>   ;; (define-key yas-minor-mode-map [(tab)]        nil)
>   ;; (define-key yas-minor-mode-map (kbd "TAB")    nil)
>   ;; (define-key yas-minor-mode-map (kbd "<tab>")  nil)
>   )
> 
> * Current behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. tuk gets expandedtuk
> 
> * Expected behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. I get out of ttukhe first snippet (tuk does not get expanded).
> 
> tuk is this:
> # -*- mode: snippet -*-
> # name: latex-inline
> # key: tuk
> # expand-env: ((yas-indent-line 'fixed))
> # --
> \\($1\\)$0
> 
> How do I configure yasnippet so that snippets get expended with C-c m
> *only*? Thanks!

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse <at> vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Sat, 23 Jul 2022 08:06:02 GMT) Full text and rfc822 format available.

Message #14 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: edgar <at> openmail.cc
Cc: 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Sat, 23 Jul 2022 10:05:32 +0200
edgar <at> openmail.cc writes:

> I really like yasnippets, because it makes my workflow more
> productive, but I have not been able to disable the autocompletion
> with the TAB key:
>
> * What I have tried
> (use-package yasnippet :defer t :commands (yas-minor-mode)
>   :bind
>   (:map
>    yas-minor-mode-map
>    ("TAB" . nil)
>    ("<tab>" . nil)

I'm not familiar with use-package or the syntax it uses for keymaps, but
does

   (:map
    yas-minor-mode-map
    ("TAB" . nil)
    ([(tab)] . nil)

fix the issue?





Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 23 Jul 2022 08:06:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Sun, 24 Jul 2022 17:08:02 GMT) Full text and rfc822 format available.

Message #19 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: edgar <at> openmail.cc
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Sun, 24 Jul 2022 17:07:31 +0000
On 2022-07-23 08:05, Lars Ingebrigtsen wrote:
> I'm not familiar with use-package or the syntax it uses for keymaps, 
> but
> does
> 
>    (:map
>     yas-minor-mode-map
>     ("TAB" . nil)
>     ([(tab)] . nil)
> 
> fix the issue?

Hi Lars,

Unfortunately, not. This does not work either:

(with-eval-after-load 'yasnippet

  (setq yas-snippet-dirs
        (list "~/.emacs.d/snippets/"))
  (yas--load-snippet-dirs)
  ;; allow to insert a snippet within a snippet
  (setq yas-triggers-in-field t)
  ;; Change trigger key
  (define-key yas-minor-mode-map (kbd "C-i") nil)
  (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
  (define-key yas-minor-mode-map [(tab)]        nil)
  (define-key yas-minor-mode-map (kbd "TAB")    nil)
  (define-key yas-minor-mode-map (kbd "<tab>")  nil))

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse <at> vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Tue, 26 Jul 2022 12:08:02 GMT) Full text and rfc822 format available.

Message #22 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: edgar <at> openmail.cc
Cc: 56630 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Tue, 26 Jul 2022 14:07:08 +0200
edgar <at> openmail.cc writes:

> Unfortunately, not. This does not work either:
>
> (with-eval-after-load 'yasnippet
>
>   (setq yas-snippet-dirs
>         (list "~/.emacs.d/snippets/"))
>   (yas--load-snippet-dirs)
>   ;; allow to insert a snippet within a snippet
>   (setq yas-triggers-in-field t)
>   ;; Change trigger key
>   (define-key yas-minor-mode-map (kbd "C-i") nil)
>   (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
>   (define-key yas-minor-mode-map [(tab)]        nil)
>   (define-key yas-minor-mode-map (kbd "TAB")    nil)
>   (define-key yas-minor-mode-map (kbd "<tab>")  nil))

Looking at yasnippet.el, I don't see any obvious reason why that
shouldn't work.  Perhaps Noam has some comments; added to the CCs.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Sun, 31 Jul 2022 22:34:01 GMT) Full text and rfc822 format available.

Message #25 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: edgar <at> openmail.cc, 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Sun, 31 Jul 2022 18:32:51 -0400
> edgar <at> openmail.cc writes:

> >   (define-key yas-minor-mode-map (kbd "C-i") nil)
> >   (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
> >   (define-key yas-minor-mode-map [(tab)]        nil)
> >   (define-key yas-minor-mode-map (kbd "TAB")    nil)
> >   (define-key yas-minor-mode-map (kbd "<tab>")  nil))

I think there are some redundancies ((kbd "C-i") == (kbd "TAB") and
(kbd "<tab>") ~= [(tab)]), but yes, that should work. I haven't kept
up with yasnippet maintenance, so possibly there is some failure with
more recent Emacs versions (although I don't see any version numbers
mentioned in the bug report)?

Also, it would be useful to have a fully contained minimal
reproducible example, to eliminate mistakes of the sort where you have
accidentally have an extra unnoticed bit code in your init files which
is messing things up, or the yasnippet part in your config isn't
actually being evaluated for some reason.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Mon, 01 Aug 2022 20:01:02 GMT) Full text and rfc822 format available.

Message #28 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: edgar <at> openmail.cc
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Mon, 01 Aug 2022 20:00:17 +0000
[Message part 1 (text/plain, inline)]
On 2022-07-31 22:32, Noam Postavsky wrote:
> Also, it would be useful to have a fully contained minimal
> reproducible example, to eliminate mistakes of the sort where you have
> accidentally have an extra unnoticed bit code in your init files which
> is messing things up, or the yasnippet part in your config isn't
> actually being evaluated for some reason.

Thanks, I think that I had sent this:

"GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6)
 of 2022-04-28"
yasnippet                      20200604.246
org                            20210929

just in case,
(yas-about)
"yasnippet (version 0.14.0-snapshot20200604.246) -- 
pluskid/joaotavora/npostavs"

(org-version)
9.4.6

I am also attaching an org file which may serve to show a minimal 
(not-working) configuration.

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse <at> vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
[init.org.gz (application/x-gzip, attachment)]

Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 30 Aug 2022 10:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Tue, 08 Nov 2022 17:25:03 GMT) Full text and rfc822 format available.

Message #33 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: edgar <edgarlux <at> cryptolab.net>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Tue, 08 Nov 2022 14:09:37 +0000
[Message part 1 (text/plain, inline)]
I tried to send the e-mail below on 2022-08-01 20:00, but apparently it 
is not here (I'm blaming my other e-mail provider): 
https://mail.gnu.org/archive/html/bug-gnu-emacs/2022-07/msg02612.html

On 2022-07-31 22:32, Noam Postavsky wrote:

    Also, it would be useful to have a fully contained minimal
    reproducible example, to eliminate mistakes of the sort where you 
have
    accidentally have an extra unnoticed bit code in your init files 
which
    is messing things up, or the yasnippet part in your config isn't
    actually being evaluated for some reason.


Thanks, I think that I had sent this:

"GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6)
 of 2022-04-28"
yasnippet                      20200604.246
org                            20210929

just in case,
(yas-about)
"yasnippet (version 0.14.0-snapshot20200604.246) -- 
pluskid/joaotavora/npostavs"

(org-version)
9.4.6

I am also attaching an org file which may serve to show a minimal 
(not-working) configuration.
[init.org.gz (application/gzip, attachment)]
[Re bug#56630 (yasnippet) how to disable TAB tab C-i .eml (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56630; Package emacs. (Tue, 08 Nov 2022 17:25:03 GMT) Full text and rfc822 format available.

Message #36 received at 56630 <at> debbugs.gnu.org (full text, mbox):

From: edgar <edgarlux <at> cryptolab.net>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 56630 <at> debbugs.gnu.org
Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?
Date: Tue, 08 Nov 2022 14:10:08 +0000
On 2022-11-08 14:09, edgar wrote:
> I tried to send the e-mail below on 2022-08-01 20:00, but apparently
> it is not here (I'm blaming my other e-mail provider):
> https://mail.gnu.org/archive/html/bug-gnu-emacs/2022-07/msg02612.html
> 
> On 2022-07-31 22:32, Noam Postavsky wrote:
> 
>     Also, it would be useful to have a fully contained minimal
>     reproducible example, to eliminate mistakes of the sort where you 
> have
>     accidentally have an extra unnoticed bit code in your init files 
> which
>     is messing things up, or the yasnippet part in your config isn't
>     actually being evaluated for some reason.
> 
> 
> Thanks, I think that I had sent this:
> 
> "GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
> cairo version 1.17.6)
>  of 2022-04-28"
> yasnippet                      20200604.246
> org                            20210929
> 
> just in case,
> (yas-about)
> "yasnippet (version 0.14.0-snapshot20200604.246) -- 
> pluskid/joaotavora/npostavs"
> 
> (org-version)
> 9.4.6
> 
> I am also attaching an org file which may serve to show a minimal
> (not-working) configuration.

I hope that I am not ahead of myself, but this seems to be working

(autoload 'yas-minor-mode "yasnippet")
(autoload 'yas-expand "yasnippet")
(with-eval-after-load 'yasnippet
  ;; Default directories to look for snippets
  (setq yas-snippet-dirs
        (list "~/.emacs.d/snippets/"))
  (yas--load-snippet-dirs)
  ;; allow to insert a snippet within a snippet
  (setq yas-triggers-in-field t)
  ;; Change trigger key
  (define-key yas-minor-mode-map (kbd "C-i") nil)
  (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
  (define-key yas-minor-mode-map [(tab)]        nil)
  (define-key yas-minor-mode-map (kbd "TAB")    nil)
  (define-key yas-minor-mode-map (kbd "<tab>")  nil)
  (define-key global-map [remap yas-next-field-or-maybe-expand] 
'yas-next-field))

(add-hook 'org-mode-hook
          (lambda ()
            ;; Activate yasnippet
            (yas-minor-mode)
            ;; Add the latex snippets
            (yas-activate-extra-mode 'latex-mode)))




This bug report was last modified 2 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.