Page 1 of 1

emacs functions for autonumbering task labels

PostPosted: Sat Dec 24, 2005 4:11 am
by zoomcityzoom
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).]

Re: emacs functions for autonumbering task labels

PostPosted: Wed Jul 08, 2009 11:08 am
by tbims23822 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.