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

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

Re: title-case function


From: Emanuel Berg
Subject: Re: title-case function
Date: Sun, 21 Apr 2019 07:29:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Paul W. Rankin wrote:

> Happy Easter to those who celebrate it!

The same to you :)
Here is some 2h 34m 56s of Easter trance [1] :)

> I couldn't find a title-case function

Did you look into this [2] ?
    
BTW make a search for "Emanuel Berg" :)

> [...] so I wrote the one below. Please take
> a look and let me know if there are any edge
> cases I've missed or improvements you
> might have.

       (if (looking-at "[:\x2013\x2014]")
           (capitalize-word 1)
         (skip-syntax-forward "-." last-word)
         (if (looking-at (concat "\\b" (regexp-opt title-case-minor-words)
                                 "\\b") )
             (downcase-word 1)
           (capitalize-word 1)))

It seems to work alright, but I don't
understand it? You don't need `progn' anymore?

(if nil
    0
  (message "been here")
  1) ; 1 and got message

??


[1] https://www.youtube.com/watch?v=_gp51lt9kdA

[2] https://karl-voit.at/2015/05/25/elisp-title-capitalization/source.org.txt

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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