Questions tagged [skeleton]

16 questions
6
votes
2 answers

Automatically closing #ifdef block when editing C code

When editing LaTeX code, the command latex-close-block inserts an \end{..} that matches the last unclosed \begin{..}. Very handy! Is there a similar command in c-mode that would close a pending #ifdef? Ideally, I would close #ifdef __A_COND__…
phs
  • 1,095
  • 6
  • 13
5
votes
1 answer

Context sensitive skeleton triggered by abbrev stuck in loop

I want to create a skeleton, triggered by the abbrev keyword 'func' which checks its context and runs one of two possible sub-skeletons. Here's what I have: (define-skeleton my-func-skeleton "func skeleton" "" (if (looking-back "\n") ;; A…
BigBird
  • 53
  • 3
5
votes
2 answers

What templates are available for generating an elisp library?

At some point I remember encountering a command that generated a skeleton of a properly formatted emacs-lisp library as below: ;;; library.el --- summary ;; Copyright ... ;; Author: ;; Keywords: ;; License ;;; Commentary: ;; ;;;…
dgtized
  • 4,169
  • 20
  • 41
3
votes
1 answer

auto-insert a skeleton and run a function when creating a new file

auto-insert-alist by default matches files created in .../bin/ directories and enables sh-mode. There are examples on the wiki showing how to use a skeleton to insert some text, but I want to both insert some text and enable sh-mode. Some other…
Skeletor
  • 33
  • 4
2
votes
2 answers

Can there be two prefix arguments?

I am very confused by the definitions of define-skeleton and skeleton-proxy-new in skeleton.el in the emacs source (version 28.1). The command generated by the define-skeleton macro has the interactive spec "*P\nP". Whatever can that mean? Two…
q.undertow
  • 314
  • 1
  • 9
2
votes
1 answer

Redefine verilog-mode header skeleton

The verilog-mode package contains this code: (define-skeleton verilog-sk-header-tmpl "Insert a comment block containing the module title, author, etc." "[Description]: " "// -*- Mode: Verilog -*-" "\n// Filename …
adrianf0
  • 23
  • 2
1
vote
1 answer

Skeleton for org source blocks causing issues

I've tried to setup a skeleton to speed up entering org source blocks (define-skeleton skel-org-block "Insert an org block, querying for type." "Type: " "#+begin_" str " " (setq v1 (skeleton-read "Language and headers?: ")) "\n" _ - \n …
nonreligious
  • 473
  • 2
  • 14
1
vote
1 answer

Skeletons: non-interactive subskeletons?

§12 Skeleton Language lists, as an element of a skeleton input list, skeleton Subskeletons are inserted recursively, not once, but as often as the user enters something at the subskeletons interactor. Thus there must be a `str` in the…
RoUS
  • 111
  • 3
1
vote
1 answer

Relationship between Skeleton and Tempo

Emacs ships with two packages for creating and inserting templates: Tempo and Skeleton. As far as I can tell, they fulfill the same purpose. Am I missing something?
Nova
  • 1,059
  • 9
  • 21
1
vote
1 answer

Limit emacs skeleton pairs

I have the following skeleton pair setup to quickly insert LaTeX fragents into org-mode documents: (setq skeleton-pair t) (global-set-key (kbd "$") 'skeleton-pair-insert-maybe) This works. But the trouble is that it works everywhere. How can I…
Adam
  • 1,857
  • 11
  • 32
1
vote
1 answer

Insert quote characters in define-skeleton

In the following skeleton definition, I like to have quote characters ", ` and ' in the generated skeleton code. For example, I like to have the effect of #+NAME:a-function-test #+BEGIN_SRC clojure (facts "about `a-function'" ) #+END_SRC…
Yu Shen
  • 451
  • 4
  • 15
0
votes
0 answers

Abbrevs with Skeletons no longer expanding

I've mashed together my own form of "snippets" in Emacs with Skeletons and Abbrevs. I updated the exact macro for generating both the abbrev and skeleton function, but now abbrevs never expand. A few things to get out of the way: abbrev-mode is…
0
votes
1 answer

Is it possible to have expand abbreviations when calling a skeleton-read?

I have a large set of abbreviations I defined inside an abbrev-table. Take one of them: (define-abbrev-table 'latex-mode-abbrev-table '(("ff" "my abbreviation!" 0 nil))) If I run a predefined function that calls things through skeleton-read is…
JeffDror
  • 53
  • 5
0
votes
2 answers

How to insert boilerplate code in a file based on the directory in which it is created?

Suppose I have a file dir1/this_file.txt and dir2/this_file.txt, and I want to insert different boilerplate code not based on the file name or extension, but based on the directory in which the file is created. How can I do that? -- Edit --…
Prikshet Sharma
  • 237
  • 1
  • 3
0
votes
1 answer

How to control cursor position when using a function for inserting a skeleton

I am using the following function to make a new text file containing premade rows. The text file is named with a date and time tag, and stored in a /notes/ folder. (defun myfun-create-file-with-rows() (interactive) (find-file…
myotis
  • 1,099
  • 1
  • 13
  • 27
1
2