From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Is there a code better than the other? Date: Thu, 04 Jul 2013 17:07:17 +0200 Organization: Sebastien Vauban Message-ID: <861u7euzx6.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372950634 24599 80.91.229.3 (4 Jul 2013 15:10:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Jul 2013 15:10:34 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Thu Jul 04 17:10:39 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UulB9-0003Qw-1x for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Jul 2013 17:10:39 +0200 Original-Received: from localhost ([::1]:33040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulB8-0004mo-JJ for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Jul 2013 11:10:38 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 47 Injection-Info: mx05.eternal-september.org; posting-host="402b34550bd938aa98825778083dce0e"; logging-data="7908"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX19D5eC0leV6DkPzhVJc6/7g" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt) X-Url: Under construction... X-Archive: encrypt Cancel-Lock: sha1:FbcdTwqYFj3C5t0wdHokXOmouOA= sha1:6KV6BWUvaB7K7Ypw6nZDrEDJeEU= Original-Xref: usenet.stanford.edu gnu.emacs.help:199675 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:91941 Archived-At: Hello, When searching for info on the web, I found the following chunks of code to automatically reload snippets after saving. --8<---------------cut here---------------start------------->8--- ;; https://github.com/vderyagin/dotemacs/blob/master/conf/yasnippet-configuration.el (eval-after-load "yasnippet" '(progn (add-hook 'snippet-mode-hook (lambda () (setq require-final-newline nil) (add-hook 'after-save-hook 'yas-recompile-all 'append 'make-it-local) (add-hook 'after-save-hook 'yas-reload-all 'append 'make-it-local))))) --8<---------------cut here---------------end--------------->8--- and --8<---------------cut here---------------start------------->8--- ;; https://earthserver.com/Setting_up_a_C%2B%2B11_development_environment_on_Linux_with_Clang_and_Emacs ;; automatically reload snippets after saving: (defun reload-snippets () (interactive) (yas-reload-all) (yas-recompile-all) (yas-reload-all) (yas-recompile-all)) (defun snippet-mode-before-save () (interactive) (when (eq major-mode 'snippet-mode) (reload-snippets))) (add-hook 'after-save-hook 'snippet-mode-before-save) --8<---------------cut here---------------end--------------->8--- Except the small differences (2 x reload and 2 x recompile, or the "don't require final newline"), is there one better than the other? There are differences on the "make it local" hook "after-save". Is there a writing that will be more portable (during time) than the other? Best regards, Seb -- Sebastien Vauban