From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: html2text-remove-tags documentation Date: Wed, 27 Jul 2011 08:51:16 +0200 Message-ID: <4E2FB564.5040403@online.de> References: <4E2BE1A9.6010805@dogan.se> <4E2F6D4C.2060107@dogan.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311749490 20204 80.91.229.12 (27 Jul 2011 06:51:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jul 2011 06:51:30 +0000 (UTC) Cc: Deniz Dogan To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 27 08:51:25 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qlxxk-0007P8-OB for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2011 08:51:24 +0200 Original-Received: from localhost ([::1]:46949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlxxk-0003fF-9j for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2011 02:51:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlxxi-0003f2-7s for emacs-devel@gnu.org; Wed, 27 Jul 2011 02:51:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlxxg-0003l0-Ou for emacs-devel@gnu.org; Wed, 27 Jul 2011 02:51:22 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.9]:63005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlxxg-0003kZ-Ck for emacs-devel@gnu.org; Wed, 27 Jul 2011 02:51:20 -0400 Original-Received: from [192.168.178.27] (brln-4dbc767f.pool.mediaWays.net [77.188.118.127]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0Ldqqt-1RBMwh3hXH-00j5ja; Wed, 27 Jul 2011 08:51: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 In-Reply-To: <4E2F6D4C.2060107@dogan.se> X-Provags-ID: V02:K0:q7WOBqISnr98xRkNIcq9/BpNPDCi7UWHagn0NjX+9MF jgCYwzsSSIfeWY6L9zDhuhBiZu1peBRMHwYCWdhX2rtwNW9CCs xE8At2i7vPxQEg/4fMPkG0TD6DhjpQjOzMEA1mOMdMaS6/OBQA +7OYmA/hEr2n0EDHx8snY7IaJdkeXKdO6xfv8FCj6CYBEIpVFK TqtnkxuMXEywNer/GVd4bnYGIFlb6HLz9fHT695nmk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142344 Archived-At: Am 27.07.2011 03:43, schrieb Deniz Dogan: > On 2011-07-24 11:11, Deniz Dogan wrote: >> This is the definition of `html2text-remove-tags' in >> lisp/gnus/html2text.el: >> >> (defun html2text-remove-tags (tag-list) >> "Removes the tags listed in the list `html2text-remove-tag-list'. >> See the documentation for that variable." >> (interactive) >> (dolist (tag tag-list) >> (goto-char (point-min)) >> (while (re-search-forward (format "\\(]*>\\)" tag) (point-max) t) >> (delete-region (match-beginning 0) (match-end 0))))) >> >> As you can see, the documentation is clearly incorrect. The function >> removes the tags in TAG-LIST, not `html2text-remove-tag-list'. >> Furthermore, the function is interactive which doesn't make sense the >> way it's written now. >> >> 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 "\\(]*>\\)" 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 > > Hi Deniz, as the argument is mandatory, it will not take the wrong thing. `html2text-remove-tag-list' is just a proposal for proper use. You may give any appropriate list to work with. You could enhance the docu maybe writing: "Removes the tags listed in TAG-LIST, see `html2text-remove-tag-list' for example." Also it might be useful IMHO making it restrict to active region, introducing something like: (let ((beg (cond (beg) ((region-active-p) (region-beginning)) (t (point-min)))) (end (cond (end (copy-marker end)) ((region-active-p) (copy-marker (region-end))) (t (copy-marker (point-max)))))) etc. Thanks, Andreas