From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 22:37:26 2025 Received: (at submit) by debbugs.gnu.org; 7 Apr 2025 02:37:26 +0000 Received: from localhost ([127.0.0.1]:50852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1cMY-0004T0-1Y for submit@debbugs.gnu.org; Sun, 06 Apr 2025 22:37:26 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43720) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1cMV-0004SK-7F for submit@debbugs.gnu.org; Sun, 06 Apr 2025 22:37:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u1cMP-0001aO-Cs for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2025 22:37:17 -0400 Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u1cMN-0002Wo-8D for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2025 22:37:17 -0400 Received: by mail-oo1-xc41.google.com with SMTP id 006d021491bc7-601a46ee19fso1930293eaf.0 for ; Sun, 06 Apr 2025 19:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743993434; x=1744598234; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=+INfDfnvEbNJEhfiT9BbELAYE9WBxdAMUY/NgZobQkY=; b=YlnpAFFUWyedGlVlsCvOfBsppE8IpZ/ndFQCzsmcs671nHTcgA+Q9W9qrcAVUpPRW8 d4mQft1PsdRC82Cyf/NXcPxElmbliPHrec1+ylSs1gNJWFzCoaiWNzxF66Y+Ym2xtOm4 D/XL7w/dapjpmiBmjP4ukgPJoXUfF/02MBJwR9GF9YLGd4t8hlin3RyEnM80ZirhRVlq wosusQwFqaxvXMnI4uIv0GXK8f+DDcbxwK8xRJtgxfXFyFbd3qg9Q+P/yRd5+CCZwWlC ArpvZ/gyF8yrh+9nebfNsbeBT6OUO0HnOMOSgJR5KyjMXL0crrXNWMwKprrP+ygjRYc3 Tk6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743993434; x=1744598234; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+INfDfnvEbNJEhfiT9BbELAYE9WBxdAMUY/NgZobQkY=; b=G2O40r/1Xa952Uro3ALBJaTpQLCpDKA+cR+9Jv+NSkWqugZZ9gUqy5G8BCgRa9nHhp d2PCmN8HpJ18OtV6XAgOB5pvEmltIzXlsES/yoOhRAk+TS7PZsb1vyxlRW7hH6qYJfWW r5Hkdxo3y1RgnRC5Q3GBCXsJD7ofhXp4bz+yKYGQoY5GzGMkStFX7y8JNUUJ6vpgqgwN QVGBxzu7WdJNu7wUtLeh79288rhc0VBdST82XTuVXQYTbiB5uwel+8DSSIURlh3tWx19 qDISMucuH/6m18t4tycB0+7g5D6B8+wjAhlBLg4WeT4cinjgFPwqlphfDnIkL5CjwXTb CALg== X-Gm-Message-State: AOJu0YyhI08n8xODmWWND9fQFDMZ2QI9JvroezN6vlpa86k+MeJqfoPy nht3XmPcogrXcs7Sl2QC7656KJzyE436bHSN6bZcskmudU485fhgFEDYEhNf X-Gm-Gg: ASbGncsRTw5Y8A3YF/temAvrXv6SKnPpJEWs25UQ6h4zjcPMQ16fBBFpHN0AhZApMW9 HMVWBnHSwWRIsj2GfIQEi38y5ak0dUpJ6iXHn8+Ba8eCFKRaZSNzPfOf83OzkNcWj6zTMOJhAMo kEQ/faUrJzmud3dHu49MJdlo40pdMuP07KwL45DwBYewcKnk65y8LFqAOY415Wuu7Mta9it5Qit 9pG0DUefb8/P1ObW8kr9UYKyHwiYH7Npa1uKSH+QUirOq+1i7XqsgYUKPGA5wWCUccVJjLoIozr njb+z5K2nCGL X-Google-Smtp-Source: AGHT+IGZ1yLkyDh48frodsQKBMXJ8wWHacU4weFtxax5P/m1yNYfMZnIE6Xr1YgXcRZLiDBX4TB1hA== X-Received: by 2002:a05:6808:10c5:b0:3f9:d5a2:899b with SMTP id 5614622812f47-4004669f705mr6344348b6e.38.1743993433469; Sun, 06 Apr 2025 19:37:13 -0700 (PDT) Received: from fedora ([2806:10ae:e:79da::1]) by smtp.gmail.com with ESMTPSA id 5614622812f47-40040080a15sm1593680b6e.34.2025.04.06.19.37.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Apr 2025 19:37:12 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: bug-gnu-emacs@gnu.org Subject: (Proof-of-Concept) Create projects with project templates Date: Sun, 06 Apr 2025 20:37:11 -0600 Message-ID: <87mscselyg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::c41; envelope-from=eg642616@gmail.com; helo=mail-oo1-xc41.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello, i want to share this package concept for create projects with templates, this idea is similar to what EDE and skeletor.el (from MELPA) offers. The project template system aims to be simple to use for the user and simple for people who wants to create new project templates. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain Hello, i want to share this package concept for create projects with templates, this idea is similar to what EDE and skeletor.el (from MELPA) offers. The project template system aims to be simple to use for the user and simple for people who wants to create new project templates. New project templates are created in this way: |-- DIRECTORY_WHERE_TEMPLATES_LIVE | |-- PROJECT_TYPE_TEMPLATE_DIR | | |-- PROJECT_FILE... | | |-- PROJECT_FILE_2... | | |-- `project-template-info' | |-- ANOTHER_PROJECT_TYPE_TEMPLATE_DIR | | |-- ANOTHER_PROJECT_FILE... | | |-- ANOTHER_PROJECT_FILE_2... | | |-- `project-template-info' The templates are created as real directories and files that should be stored in a directory (DIRECTORY_WHERE_TEMPLATES_LIVE) which should contain a file (project-template-info) that specifies project type (for prompt to user which project type want to create); also offers integration with project.el (for indexing the project created to project list) and vc.el (if user wants use a versions control in the created project). The `project-template-info' scheme is something like this: ;;; -*- lisp-data -*- ;;; This file contains project type to use in project-templates. (:type "Make") For create a new project the user will need to run `project-templates-create-new-project' command which will prompt for: - Project type (it will be a list which contains all the project templates fetched) - Project name - Version Control to use (It preselect `None') - Add project to projects list (project.el) - Directory to where create the project I made a test concept (it don't create a real project yet). In case you want to try it. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-project-creation-capabilities-with-project-templ.patch Content-Transfer-Encoding: quoted-printable >From dc1034909638adcdf209f5b240780a8e4b9c09df Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D Date: Sun, 6 Apr 2025 11:32:12 -0600 Subject: [PATCH] Add project creation capabilities with project templates.= =20 (bug#) TODO: ChangeLog --- etc/project-templates/make/make | 1 + .../make/project-template-info | 3 + lisp/progmodes/project-templates.el | 110 ++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 etc/project-templates/make/make create mode 100644 etc/project-templates/make/project-template-info create mode 100644 lisp/progmodes/project-templates.el diff --git a/etc/project-templates/make/make b/etc/project-templates/make/m= ake new file mode 100644 index 00000000000..bc60bf4b019 --- /dev/null +++ b/etc/project-templates/make/make @@ -0,0 +1 @@ +TODO: diff --git a/etc/project-templates/make/project-template-info b/etc/project= -templates/make/project-template-info new file mode 100644 index 00000000000..2becad17311 --- /dev/null +++ b/etc/project-templates/make/project-template-info @@ -0,0 +1,3 @@ +;;; -*- lisp-data -*- +;;; This file contains project type to use in project-templates. +(:type "Make") diff --git a/lisp/progmodes/project-templates.el b/lisp/progmodes/project-t= emplates.el new file mode 100644 index 00000000000..79338670ead --- /dev/null +++ b/lisp/progmodes/project-templates.el @@ -0,0 +1,110 @@ +;;; project-templates.el --- Create projects with templates -*- lexical-b= inding: t; -*- + +;; Copyright (C) 2025 Free Software Foundation, Inc. +;; Version: 0.1.0 +;; Package-Requires: ((emacs "26.1") (project "0.11.1")) + +;; Author: Elijah Gabe P=C3=A9rez + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This file allow to create projects based in directory templates, also +;; offers integration with project.el for indexing the projects created. +;; +;; New project templates are created in this way: +;; =E2=94=9C=E2=94=80=E2=94=80 DIRECTORY_WHERE_TEMPLATES_LIVE +;; =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 PROJECT_TYPE_TEMPLATE_DIR +;; =E2=94=82 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 PROJECT_FILE... +;; =E2=94=82 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 PROJECT_FILE_2... +;; =E2=94=82 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 `project-template-info' +;; =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 ANOTHER_PROJECT_TYPE_TEMPLATE_DIR +;; =E2=94=82 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 ANOTHER_PROJECT_FILE... +;; =E2=94=82 =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 ANOTHER_PROJECT_FILE_2.= .. +;; =E2=94=82 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 `project-template-info' +;; Create a new sub-directory in `project-user-templates-directory' path +;; and inserting there all the directories and files needed for the projec= t. +;; It's needed to create a file named: `project-template-info' inside +;; project template directory which should contain the project type. +;; That file will not be included in the created project. + +;;; Code: + +(defgroup project-templates nil + "Create project templates." + :version "30.1" + :group 'tools) + +(defcustom project-user-templates-directory (expand-file-name "project-tem= plates" user-emacs-directory) + "User directory where the project templates are stored." + :type 'directory + :group 'project-templates + :version "30.1") + +(defconst project-template-default-dir (expand-file-name "project-template= s" "../../etc") + "Default directory where project templates are stored.") + +(defconst project-template--info-file "project-template-info" + "File used to store project template information.") + +(defun project-templates--get-subdirectories (dir) + "Return all sub-directories in DIR as a list." + (if (file-directory-p dir) + (let ((dirs (file-name-as-directory dir))) + (seq-filter #'file-directory-p + (directory-files dirs t "^[^.]"))))) + +(defun project-templates--get-project-type (dir) + "Return project type in DIR as a list." + ;; Search in current directory DIR for project-template--info-file + ;; and it's information + (if-let* ((file (locate-file project-template--info-file `(,dir)))) + (with-temp-buffer + (insert-file-contents file) + (read (current-buffer))))) + +;; TODO: Add project `project-templates-create-new-project' to menu-bar-pr= oject-menu +(defun project-templates-create-new-project () + (interactive) + "Create a new project from a template." + (let* ((subdirs (append (project-templates--get-subdirectories + project-template-default-dir) + (project-templates--get-subdirectories + project-user-templates-directory))) + ;; DIR is used to know where is the path for the selected + ;; project type. + (projs-data (mapcar (lambda (dir) + (append (project-templates--get-project-typ= e dir) + `(:dir ,dir))) + subdirs)) + (types (flatten-list (mapcar (lambda (data) (plist-get data :type= )) projs-data))) + (choice (completing-read "Select Project type: " types nil t)) + (proj-name (read-string "Insert Project name: ")) + (vc (completing-read "Which VC backend should new project use (de= fault: None): " + (append vc-handled-backends '(None)) + nil t nil nil "None")) + (index-p (yes-or-no-p "Should project be indexed in your project = list")) + (create-dir (read-directory-name "Create to: "))) + ;; TEMP: + (print projs-data) + (print types) + (print choice) + ;; path to chosen project type template + (print (plist-get (cdr (alist-get :type projs-data)) :dir)))) + +(provide 'project-templates) +;;; project-templates.el ends here --=20 2.49.0 --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=--