help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

upcase-initials-region on show-duvall-jefferies-etal-1993


From: steve-humphreys
Subject: upcase-initials-region on show-duvall-jefferies-etal-1993
Date: Fri, 7 May 2021 04:26:49 +0200

I have strings in a file of the form "Show-Duvall-Jefferies-etAl-1993".

Would like to switch between the following three versions

"Show-Duvall-Jefferies-Etal-1993"  ;
"SHOW-DUVALL-JEFFERIES-ETAL-1993"  ; can be done with upcase-region
"show-duvall-jefferies-etal-1993"  ; can be done with downcase-region
"Show-Duvall-Jefferies-Etal-1993"  ; cannot be done with upcase-initials-region

I am getting the bounds ($ma $mb) for the string like this

(defun alnum-dash-bounds ()
   "Gets bounds of a subword unit defined by [:alnum:] and dash."

   (let ( ($bounds nil) $ma $mb )

      (skip-chars-backward "[:alnum:]-")  ; same as ""[a-zA-Z0-9]-"
      (setq $ma (point))
      (skip-chars-forward "[:alnum:]-")
      (setq $mb (point))
      (cons $ma $mb) ))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]