all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Reiner Steib <4uce.02.r.steib@gmx.net>
Subject: Re: Regular expression - replace lower case to upper case
Date: Fri, 01 Nov 2002 20:34:29 +0100	[thread overview]
Message-ID: <v9smylulru.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: m31y66koha.fsf@localhost.localdomain

On Fri, Nov 01 2002, Michael Slass wrote:

> Try this:
>
> (defun upcase-html-tags (buf)
>  (interactive "*bUpcase html tags in buffer: ")
[...]
>       (message "upcased %d html tags" counter)))) 

Nice. I changed your function slighly: include closing tags (</foo>),
always use current buffer. Because I prefer lowercase tags, you need
do give a prefix argument, if you want uppercase tags:

M-x rs-html-downcase-or-upcase-tags RET     --> downcase buffer
C-u M-x rs-html-downcase-or-upcase-tags RET --> upcase buffer

(defun rs-html-downcase-or-upcase-tags (&optional upcase)
  "Downcase html-tags in curent buffer.  If given a prefix, upcase tags."
  (interactive "P")
  (save-excursion
    (goto-char (point-min))
    (let ((counter 0))
      (while (re-search-forward "</?\\(\\w+\\)>" nil t)
	(funcall
	 (if upcase 'upcase-region 'downcase-region)
	 (match-beginning 1) (match-end 1))
	(setq counter (1+ counter)))
      (message "%scased %d html-tags" (if upcase "up" "down") counter))))

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

  reply	other threads:[~2002-11-01 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-01  4:33 Regular expression - replace lower case to upper case Rod Farmer
2002-11-01  2:32 ` Michael Slass
2002-11-01 19:34   ` Reiner Steib [this message]
2002-11-01 21:49     ` Michael Slass
2002-11-01  2:33 ` David Forrest

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9smylulru.fsf@marauder.physik.uni-ulm.de \
    --to=4uce.02.r.steib@gmx.net \
    --cc=reiner.steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.