[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
skeleton functions and newline
From: |
Harry Putnam |
Subject: |
skeleton functions and newline |
Date: |
26 Nov 2000 05:53:58 -0800 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.5 |
Using the skeleton definition below as a model:
(define-skeleton hp-keywords
"Insert nifty keywords string."
nil
"Keywords: " _ \n
(format-time-string "%b %d %T %Y") \n
"&&" \n)
I'm trying to write a similar one that inserts an editorial comment
and the date in specified format but doesn't insert a newline and
leaves the cursor one space after the date like this:
[HP -ed] Nov 26 04:48:06 2000 [] <==cursor
I want to be able to insert this into a line without inserting a newline.
(define-skeleton hp-date
"Insert [HP -ed] comment and
date string with no newline."
nil
"[HP -ed] "
(format-time-string "%b %d %T %Y")_)
I've removed all newline symbols and relocated the underscore to get
the result I want. It works but if something else is on the line it
gets zapped onto the next line.
Example:
In this line below:
If i insert the skeleton here [] ..text.
Then "..text" gets zapped onto the next line. I want the insertion to
just push it to the right without a newline.
To really enhance the versatility of the above skeleton I'd like to
add the ability to adjust the date in the same way the gnu `date`
command can be adjusted like:
date -d "now -1 day" to print yesterdays date.
Can this be done by incorporating the C-u prefix somehow?
I've imagined a command like:
C-u -1 M-x hp-date <RET>
Or do I have to run it thru `tr -d"\012"' some how to remove the
trailing newline?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- skeleton functions and newline,
Harry Putnam <=