From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: html2text-remove-tags documentation Date: Sun, 24 Jul 2011 11:11:05 +0200 Message-ID: <4E2BE1A9.6010805@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 1311498710 31964 80.91.229.12 (24 Jul 2011 09:11:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 24 Jul 2011 09:11:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 24 11:11:47 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 1Qkuiw-0004Wn-Ms for ged-emacs-devel@m.gmane.org; Sun, 24 Jul 2011 11:11:46 +0200 Original-Received: from localhost ([::1]:36114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qkuiw-0000QH-5r for ged-emacs-devel@m.gmane.org; Sun, 24 Jul 2011 05:11:46 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qkuit-0000QC-OD for emacs-devel@gnu.org; Sun, 24 Jul 2011 05:11:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qkuis-0004ej-GW for emacs-devel@gnu.org; Sun, 24 Jul 2011 05:11:43 -0400 Original-Received: from ch-smtp05.sth.basefarm.net ([80.76.153.6]:34912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qkuis-0004eY-4z for emacs-devel@gnu.org; Sun, 24 Jul 2011 05:11:42 -0400 Original-Received: from c80-216-105-155.bredband.comhem.se ([80.216.105.155]:50536 helo=[192.168.0.10]) by ch-smtp05.sth.basefarm.net with esmtp (Exim 4.76) (envelope-from ) id 1QkuiV-0004fY-Ir for emacs-devel@gnu.org; Sun, 24 Jul 2011 11:11:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 X-Originating-IP: 80.216.105.155 X-Scan-Result: No virus found in message 1QkuiV-0004fY-Ir. X-Scan-Signature: ch-smtp05.sth.basefarm.net 1QkuiV-0004fY-Ir 9124a34ef6eaee5974218eb2fd77e448 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.76.153.6 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:142246 Archived-At: 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? Deniz