* Constructing code template systems @ 2022-10-17 22:36 Heime via Users list for the GNU Emacs text editor 2022-10-19 0:17 ` John Haman 0 siblings, 1 reply; 6+ messages in thread From: Heime via Users list for the GNU Emacs text editor @ 2022-10-17 22:36 UTC (permalink / raw) To: help-gnu-emacs@gnu.org Is there a way to construct code template systems, e.g. elisp? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Constructing code template systems 2022-10-17 22:36 Constructing code template systems Heime via Users list for the GNU Emacs text editor @ 2022-10-19 0:17 ` John Haman 2022-10-19 0:36 ` Emanuel Berg 2022-10-19 0:58 ` Heime 0 siblings, 2 replies; 6+ messages in thread From: John Haman @ 2022-10-19 0:17 UTC (permalink / raw) To: help-gnu-emacs On 10/17/22 6:36 PM, Heime via Users list for the GNU Emacs text editor wrote: > code template systems Like macros? -- Dr. John Haman Bethesda, MD ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Constructing code template systems 2022-10-19 0:17 ` John Haman @ 2022-10-19 0:36 ` Emanuel Berg 2022-10-19 0:58 ` Heime 1 sibling, 0 replies; 6+ messages in thread From: Emanuel Berg @ 2022-10-19 0:36 UTC (permalink / raw) To: help-gnu-emacs John Haman wrote: >> code template systems > > Like macros? There are macros in Elisp and they are code that produce code, this makes them more difficult to write and debug, I'm unsure what the advantages are but there are certain occasions where it is practical to do, someone else has to fill you in on those typical cases ... There are also keyboard macros that are really poor-man's programming. In the real world, while it is okay to be poor, in the sense it doesn't, or shouldn't make your life any less valuable to you or anyone else, it certainly isn't cool to be poor and in the Elisp world, where programming is free of charge, there is even less reason to ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Constructing code template systems 2022-10-19 0:17 ` John Haman 2022-10-19 0:36 ` Emanuel Berg @ 2022-10-19 0:58 ` Heime 2022-10-19 1:23 ` Emanuel Berg 2022-10-19 4:12 ` Jean Louis 1 sibling, 2 replies; 6+ messages in thread From: Heime @ 2022-10-19 0:58 UTC (permalink / raw) To: John Haman; +Cc: help-gnu-emacs ------- Original Message ------- On Wednesday, October 19th, 2022 at 12:17 AM, John Haman <mail@johnhaman.org> wrote: > On 10/17/22 6:36 PM, Heime via Users list for the GNU Emacs text editor > wrote: > > > code template systems > > > Like macros? Do not know what emacs calls them. Basically rather than writing the following, I just press some text, and the section of code gets inserted for me. (:documentation (concat "DECSTR.\n\n" DETAILS)) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Constructing code template systems 2022-10-19 0:58 ` Heime @ 2022-10-19 1:23 ` Emanuel Berg 2022-10-19 4:12 ` Jean Louis 1 sibling, 0 replies; 6+ messages in thread From: Emanuel Berg @ 2022-10-19 1:23 UTC (permalink / raw) To: help-gnu-emacs Heime wrote: >> Like macros? > > Do not know what emacs calls them. > > Basically rather than writing the following, I just press > some text, and the section of code gets inserted for me. > > (:documentation (concat "DECSTR.\n\n" DETAILS)) Okay, then it's not macros nor keyboard macros but a snippet expander! If so yes, they exist and flourish, I don't use them myself but I know there are several ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Constructing code template systems 2022-10-19 0:58 ` Heime 2022-10-19 1:23 ` Emanuel Berg @ 2022-10-19 4:12 ` Jean Louis 1 sibling, 0 replies; 6+ messages in thread From: Jean Louis @ 2022-10-19 4:12 UTC (permalink / raw) To: Heime; +Cc: John Haman, help-gnu-emacs * Heime <heimeborgia@protonmail.com> [2022-10-19 04:00]: > ------- Original Message ------- > On Wednesday, October 19th, 2022 at 12:17 AM, John Haman <mail@johnhaman.org> wrote: > > > > On 10/17/22 6:36 PM, Heime via Users list for the GNU Emacs text editor > > wrote: > > > > > code template systems > > > > > > Like macros? > > Do not know what emacs calls them. > > Basically rather than writing the following, I just press some text, > and the section of code gets inserted for me. > > (:documentation (concat "DECSTR.\n\n" DETAILS)) Evaluate following to get into section explaining about skeletons: (info "(autotype) Top") I often use this one: --------------------- (define-skeleton with-tabulated-id "Helper skeleton for `tabulated-list-get-id'" nil "(defun " (skeleton-read "Function name: ") " (" (skeleton-read "Arguments: " "&optional id") ") \"\" (interactive) (when-tabulated-id \"" (skeleton-read "Table: ") "\" ))") Or I use this one to generate necessary SQL: -------------------------------------------- (define-skeleton cf-sql-table "Prepare the SQL table for Central Files database design." nil " -- ------------------------------------------ -- ------------ Table " (setq table (skeleton-read "Table name: ")) " -- ------------------------------------------ DROP SEQUENCE " table "_id_seq; CREATE TABLE " table " ( " table "_id INTEGER GENERATED BY DEFAULT AS IDENTITY, " table "_uuid UUID NOT NULL DEFAULT gen_random_uuid(), " table "_datecreated TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, " table "_datemodified TIMESTAMP, " table "_usercreated TEXT NOT NULL DEFAULT current_user, " table "_usermodified TEXT NOT NULL DEFAULT current_user, " table "_name TEXT, " table "_description TEXT, " table "_ TEXT ); GRANT ALL ON " table " TO PUBLIC; DROP VIEW " table "_combo; CREATE OR REPLACE VIEW " table "_combo AS SELECT " table "_id AS id, " table "_name AS TEXT FROM " table "; GRANT SELECT ON " table "_combo TO PUBLIC; COMMENT ON TABLE " table " IS '" (capitalize table) "'; COMMENT ON COLUMN " table "." table "_id IS 'ID'; COMMENT ON COLUMN " table "." table "_uuid IS 'UUID'; COMMENT ON COLUMN " table "." table "_datecreated IS 'Date created'; COMMENT ON COLUMN " table "." table "_datemodified IS 'Date modified'; COMMENT ON COLUMN " table "." table "_usercreated IS 'User created'; COMMENT ON COLUMN " table "." table "_usermodified IS 'User modified'; COMMENT ON COLUMN " table "." table "_name IS 'Name'; COMMENT ON COLUMN " table "." table "_description IS 'Description'; COMMENT ON COLUMN " table "." table "_IS ''; CREATE UNIQUE INDEX " table "_index ON " table " ( " table "_name ); -- INSERT INTO " table " (" table "_name) VALUES (''); -- INSERT INTO meta_tables VALUES ('" table "', 'hide', '1'); -- Triggers -- For Date Modified CREATE TRIGGER " table "_moddatetime BEFORE UPDATE ON " table " FOR EACH ROW EXECUTE PROCEDURE moddatetime(" table "_datemodified); -- For User Modified CREATE TRIGGER insert_username_" table " BEFORE INSERT OR UPDATE ON " table " FOR EACH ROW EXECUTE PROCEDURE insert_username(" table "_usermodified); ") -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-19 4:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-17 22:36 Constructing code template systems Heime via Users list for the GNU Emacs text editor 2022-10-19 0:17 ` John Haman 2022-10-19 0:36 ` Emanuel Berg 2022-10-19 0:58 ` Heime 2022-10-19 1:23 ` Emanuel Berg 2022-10-19 4:12 ` Jean Louis
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.