all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to have yasnippet only for C/C++ files ?
@ 2019-03-26 15:05 jonetsu
  2019-03-26 15:43 ` Óscar Fuentes
  2019-03-26 15:46 ` Doug Davis
  0 siblings, 2 replies; 5+ messages in thread
From: jonetsu @ 2019-03-26 15:05 UTC (permalink / raw)
  To: help-gnu-emacs

I've installed the yasnippets package and I find it great for C/C++.
However I have searched about how to enable it only for C/C++ files
(mode) and have found nothing so far.  Many references about global
mode, although I do not really want it to be global.

So, how to enable yasnippets only for C/C++ files ?

Thanks !



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to have yasnippet only for C/C++ files ?
  2019-03-26 15:05 How to have yasnippet only for C/C++ files ? jonetsu
@ 2019-03-26 15:43 ` Óscar Fuentes
  2019-03-26 15:48   ` jonetsu
  2019-03-26 15:46 ` Doug Davis
  1 sibling, 1 reply; 5+ messages in thread
From: Óscar Fuentes @ 2019-03-26 15:43 UTC (permalink / raw)
  To: jonetsu; +Cc: help-gnu-emacs

jonetsu <jonetsu@teksavvy.com> writes:

> So, how to enable yasnippets only for C/C++ files ?

(add-hook 'c-mode-hook 'yas-minor-mode)
(add-hook 'c++-mode-hook 'yas-minor-mode)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to have yasnippet only for C/C++ files ?
  2019-03-26 15:05 How to have yasnippet only for C/C++ files ? jonetsu
  2019-03-26 15:43 ` Óscar Fuentes
@ 2019-03-26 15:46 ` Doug Davis
  2019-03-26 19:08   ` jonetsu
  1 sibling, 1 reply; 5+ messages in thread
From: Doug Davis @ 2019-03-26 15:46 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Check here:
https://github.com/joaotavora/yasnippet#use-yas-minor-mode-on-a-per-buffer-basis

Looks like you can do

(add-hook 'c-mode-common-hook #'yas-minor-mode)

Cheers,
Doug

jonetsu writes:

> I've installed the yasnippets package and I find it great for C/C++.
> However I have searched about how to enable it only for C/C++ files
> (mode) and have found nothing so far.  Many references about global
> mode, although I do not really want it to be global.
>
> So, how to enable yasnippets only for C/C++ files ?
>
> Thanks !



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to have yasnippet only for C/C++ files ?
  2019-03-26 15:43 ` Óscar Fuentes
@ 2019-03-26 15:48   ` jonetsu
  0 siblings, 0 replies; 5+ messages in thread
From: jonetsu @ 2019-03-26 15:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 26 Mar 2019 16:43:01 +0100
Óscar Fuentes <ofv@wanadoo.es> wrote:

> (add-hook 'c-mode-hook 'yas-minor-mode)
> (add-hook 'c++-mode-hook 'yas-minor-mode)

Thanks !



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to have yasnippet only for C/C++ files ?
  2019-03-26 15:46 ` Doug Davis
@ 2019-03-26 19:08   ` jonetsu
  0 siblings, 0 replies; 5+ messages in thread
From: jonetsu @ 2019-03-26 19:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 26 Mar 2019 11:46:58 -0400
Doug Davis <ddavis@ddavis.io> wrote:

> Check here:
> https://github.com/joaotavora/yasnippet#use-yas-minor-mode-on-a-per-buffer-basis
> 
> Looks like you can do
> 
> (add-hook 'c-mode-common-hook #'yas-minor-mode)

Thanks.  Since I also do some Perl from time to time, knowing about a
mode from which all programming modes are derived is useful in this
case for yasnippets:

(add-hook 'prog-mode-hook #'yas-minor-mode)

Cheers.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-26 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26 15:05 How to have yasnippet only for C/C++ files ? jonetsu
2019-03-26 15:43 ` Óscar Fuentes
2019-03-26 15:48   ` jonetsu
2019-03-26 15:46 ` Doug Davis
2019-03-26 19:08   ` jonetsu

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.