emacs-devel
[Top][All Lists]
Advanced

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

Re: html2text-remove-tags documentation


From: Andreas Röhler
Subject: Re: html2text-remove-tags documentation
Date: Wed, 27 Jul 2011 09:10:17 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11


Furthermore, the function is interactive which doesn't make sense the
way it's written now.


Thats right.

then (&optional tag-list)

in connection with

(or tag-list html2text-remove-tag-list)))

should DTRT.

Would not restrict it to interactive use,
as leaving out the argument-spec speeds up writing.

Cheers,

Andreas





So what should we do about this function?

I suggest we make TAG-LIST optional and defaulted to
`html2text-remove-tag-list', i.e., (or tag-list
html2text-remove-tag-list). If called interactively, TAG-LIST should be
a space-or-comma-separated string of tags to remove.

Such a definition could be:

(defun html2text-remove-tags (&optional tag-list)
"Remove the tags in TAG-LIST.
If TAG-LIST is nil, use `html2text-remove-tag-list'.
If called interactively, "
(interactive "MTags to remove: ")
(setq tag-list (if (called-interactively-p 'any)
(split-string tag-list "[ ,]" t)
(or tag-list html2text-remove-tag-list)))
(dolist (tag tag-list)
(goto-char (point-min))
(while (re-search-forward (format "\\(</?%s[^>]*>\\)" tag) (point-max) t)
(delete-region (match-beginning 0) (match-end 0)))))

This definition would not break any existing code as far as I can tell
and both fixes and adds functionality.

What do you think?


Bumping this hoping to get it in before the "hard" feature freeze.

Deniz






reply via email to

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