Subject: Re: bug#56630: (yasnippet) how to disable TAB <tab> C-i?

From: edgar <[email-masked]>
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)))