From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Getting rid of low-level assumptions in yasnippet Date: Thu, 19 Mar 2015 15:49:59 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1426794630 20147 80.91.229.3 (19 Mar 2015 19:50:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2015 19:50:30 +0000 (UTC) Cc: emacs-devel@gnu.org, Tassilo Horn To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 19 20:50:18 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YYgSO-0000NC-AW for ged-emacs-devel@m.gmane.org; Thu, 19 Mar 2015 20:50:16 +0100 Original-Received: from localhost ([::1]:41033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYgSN-0004wm-Fh for ged-emacs-devel@m.gmane.org; Thu, 19 Mar 2015 15:50:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYgSJ-0004wh-6s for emacs-devel@gnu.org; Thu, 19 Mar 2015 15:50:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYgSH-0004Ss-PL for emacs-devel@gnu.org; Thu, 19 Mar 2015 15:50:11 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:54003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYgSB-00044T-NE; Thu, 19 Mar 2015 15:50:03 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t2JJnx4V021445; Thu, 19 Mar 2015 15:49:59 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 656B0182C; Thu, 19 Mar 2015 15:49:59 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.1 X-NAI-Spam-Rules: 2 Rules triggered BODY_START_GREETING=0.1, RV5250=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5250> : inlines <2448> : streams <1408204> : uri <1884897> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184025 Archived-At: Hi Jo=E3o, Could you double check the patch below, to make sure it does the right thin= g? The main thrust is to get rid of the use of the `cl-struct-slots' property which doesn't exist in Emacs-25 any more. This is against the elpa.git version of the code, which IIUC is still not up-to-date, right? Stefan diff --git a/packages/yasnippet/yasnippet.el b/packages/yasnippet/yasnippet= .el index aa3e312..7b4c429 100644 --- a/packages/yasnippet/yasnippet.el +++ b/packages/yasnippet/yasnippet.el @@ -1,6 +1,6 @@ ;;; yasnippet.el --- Yet another snippet extension for Emacs. =20 -;; Copyright (C) 2008-2013 Free Software Foundation, Inc. +;; Copyright (C) 2008-2013, 2015 Free Software Foundation, Inc. ;; Authors: pluskid , Jo=E3o T=E1vora ;; Maintainer: Jo=E3o T=E1vora ;; Version: 0.8.0 @@ -856,7 +856,7 @@ Honour `yas-dont-activate', which see." ;;; Internal structs for template management =20 -(defstruct (yas--template (:constructor yas--make-blank-template)) +(defstruct (yas--template (:constructor yas--make-template)) "A template for a snippet." key content @@ -872,16 +872,6 @@ Honour `yas-dont-activate', which see." table ) =20 -(defun yas--populate-template (template &rest args) - "Helper function to populate TEMPLATE with properties." - (while args - (aset template - (position (intern (substring (symbol-name (car args)) 1)) - (mapcar #'car (get 'yas--template 'cl-struct-slots))) - (second args)) - (setq args (cddr args))) - template) - (defstruct (yas--table (:constructor yas--make-snippet-table (name))) "A table to store snippets for a particular mode. =20 @@ -1668,20 +1658,19 @@ Optional PROMPT sets the prompt to use." (uuid (or (ninth snippet) name)) (template (or (gethash uuid (yas--table-uuidhash snippet-table)) - (yas--make-blank-template)))) + (yas--make-template :uuid uuid + :table snippet-table)))) ;; X) populate the template object ;; - (yas--populate-template template - :table snippet-table - :key key - :content (second snippet) - :name (or name key) - :group group - :condition condition - :expand-env (sixth snippet) - :file (seventh snippet) - :keybinding keybinding - :uuid uuid) + (setf (yas--template-key template) key) + (setf (yas--template-content template) (second snippet)) + (setf (yas--template-name template) (or name key)) + (setf (yas--template-group template) group) + (setf (yas--template-condition template) condition) + (setf (yas--template-expand-env template) (sixth snippet)) + (setf (yas--template-file template) (seventh snippet)) + (setf (yas--template-keybinding template) keybinding) + ;; X) Update this template in the appropriate table. This step ;; also will take care of adding the key indicators in the ;; templates menu entry, if any @@ -2113,11 +2102,10 @@ This function does nothing if `yas-use-menu' is nil= ." hash) (dolist (uuid omit-items) (let ((template (or (gethash uuid hash) - (yas--populate-template (puthash uuid - (yas--make-bl= ank-template) - hash) - :table table - :uuid uuid)))) + (puthash uuid + (yas--make-template :table table + :uuid uuid) + hash)))) (setf (yas--template-menu-binding-pair template) (cons nil :none= ))))))) =20 (defun yas--define-menu-1 (table menu-keymap menu uuidhash &optional group= -list) @@ -2125,12 +2113,12 @@ This function does nothing if `yas-use-menu' is nil= ." (dolist (e (reverse menu)) (cond ((eq (first e) 'yas-item) (let ((template (or (gethash (second e) uuidhash) - (yas--populate-template (puthash (second e) - (yas--make-= blank-template) - uuidhash) - :table table - :perm-group group-li= st - :uuid (second e))))) + (puthash (second e) + (yas--make-template + :table table + :perm-group group-list + :uuid (second e)) + uuidhash)))) (define-key menu-keymap (vector (gensym)) (car (yas--template-menu-binding-pair-get-create template := stay))))) ((eq (first e) 'yas-submenu) @@ -2622,12 +2610,11 @@ whether (and where) to save the snippet, then quit = the window." (yas--current-template (and parsed (fboundp test-mode) - (yas--populate-template (yas--make-blank-template) - :table nil ;; no tables for ep= hemeral snippets - :key (first parsed) - :content (second parsed) - :name (third parsed) - :expand-env (sixth parsed))))) + (yas--make-template :table nil ;; no tables for ephem= eral snippets + :key (first parsed) + :content (second parsed) + :name (third parsed) + :expand-env (sixth parsed))))) (cond (yas--current-template (let ((buffer-name (format "*testing snippet: %s*" (yas--templa= te-name yas--current-template)))) (kill-buffer (get-buffer-create buffer-name))