xGoat
More tea please.

Emacs Joy

I used the following in emacs to replace a load of strings in a gschem symbol – I’d set pinseq to be 0 for all pins but needed it to be different for all pins. Each replacement was suffixed with a separate number. It was cool.

(setq rob-counter 0)

(defun ff ()
  "temp function."
  (let (matchedText newText)
    (setq matchedText
          (buffer-substring
           (match-beginning 0) (match-end 0)))
    (setq newText
          (replace-regexp-in-string "0" (number-to-string rob-counter) matchedText) )
    newText
    )
  (setq rob-counter (+ rob-counter 1))
  )
Posted at 3:01 pm on Monday 3rd September 2007

Comments are closed.

Site by Rob Gilton. © 2008 - 2019