Pumpkin, Inc.

Pumpkin User Forums

emacs functions for autonumbering task labels

If you have a general question or comment regarding Salvo, post it here.

emacs functions for autonumbering task labels

Postby zoomcityzoom » Sat Dec 24, 2005 4:11 am

I've written a set of lisp functions that you execute after selecting the region surrounding your task (or set of _OSLabels). The function prompts you for the base label name. An example of the label format is LBL_NAME_21. The base label name you would enter in this case is LBL_NAME. The function will searh and replace each label name while replacing whatever numeric part with an incremented value start from 0.

So, when I first write a task, such as LCD_Driver_Task, that requires _OSLabels, I'll name all of the labels LBL_LDT_0. Then, I'll select the region around the task code and type M-x number-salvo-labels <enter>. When prompted for the base label name, I enter LBL_LDT. At every occurence of LBL_LDT_n, I'll be prompted for action in the mini-buffer. Press y at each occurence to renumber all labels or press ! to automaticaly renumber all labels without further prompting.

Here is the code for your .emacs file.


(defun new-label-name (label-name replace-count)
(concat label-name "_" (number-to-string replace-count)))

(defun number-salvo-labels (label-name)
"Sequentially search for and incrementally replace the numeric portion
of a salvo label in the marked region. Format of label must be labelname_n.
Where, n is any, number of digits."
(interactive "MBase label name:")
(perform-replace (concat label-name "_[0-9]*")
(cons 'new-label-name label-name)
nil ; MAP
(region-beginning) ; START
(region-end) ; END

Using these elisp functions (emacs) to autonumber (and renumber) labels has taken the drudgery out of writing for Salvo and lets me focus on the problem at hand. If you don't use emacs, figure out a way to automate label numbering in your editor!


[This message has been edited by zoomcityzoom (edited February 15, 2006).]

Tom Deutschman
Wizbang Designs, Inc.
Posts: 13
Joined: Sat Dec 24, 2005 12:00 am
Location: Spokane, WA, USA

Re: emacs functions for autonumbering task labels

Postby tbims23822 » Wed Jul 08, 2009 11:08 am

www.drop-shopping.com is a premium website for cheap air jordans shoes and other more really nike air jordan shoes.We have varity of cheap air jordan shoes available for wholesale.Cheap China wholesale shoes including cheap Nike shoes and cheap jordan shoes,nike sneakers,nike sneakers discount,air jordan sneakers,air force sneakers.We supply nike sneakers,jordan sneakers,air jordan sneakers,air force sneakers wholesale.You can buy very cheap jordans shoes including cheap women shoes,cheap nike shoes,cheap running shoes from us.


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest