From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#19892: 25.0.50; hideshow: hs-hide-all-non-comment-function example infloop Date: Tue, 17 Feb 2015 23:45:15 +0100 Message-ID: <87r3tonon8.fsf@web.de> Reply-To: michael_heerdegen@web.de NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1424213303 4408 80.91.229.3 (17 Feb 2015 22:48:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Feb 2015 22:48:23 +0000 (UTC) Cc: ttn@gnu.org, dann@ics.uci.edu To: 19892@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 17 23:48:09 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YNqw4-0005CZ-RN for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Feb 2015 23:48:09 +0100 Original-Received: from localhost ([::1]:47652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqw4-000690-1A for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Feb 2015 17:48:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqu7-0003NN-EG for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:46:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNqu2-000322-B4 for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:46:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqu2-00031x-8R for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YNqu1-0002Zj-UN for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Feb 2015 22:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19892 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14242131429872 (code B ref -1); Tue, 17 Feb 2015 22:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Feb 2015 22:45:42 +0000 Original-Received: from localhost ([127.0.0.1]:46688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNqti-0002ZA-32 for submit@debbugs.gnu.org; Tue, 17 Feb 2015 17:45:42 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42911) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNqtf-0002Yu-DL for submit@debbugs.gnu.org; Tue, 17 Feb 2015 17:45:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNqtV-0002wI-M5 for submit@debbugs.gnu.org; Tue, 17 Feb 2015 17:45:33 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqtV-0002wD-Jk for submit@debbugs.gnu.org; Tue, 17 Feb 2015 17:45:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqtU-0002Nl-K2 for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:45:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNqtP-0002v1-JZ for bug-gnu-emacs@gnu.org; Tue, 17 Feb 2015 17:45:28 -0500 Original-Received: from mout.web.de ([212.227.17.11]:57538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNqtP-0002uo-7y; Tue, 17 Feb 2015 17:45:23 -0500 Original-Received: from drachen.dragon ([94.218.211.212]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MGiUP-1YJEJI0Ryz-00DZWw; Tue, 17 Feb 2015 23:45:17 +0100 X-Provags-ID: V03:K0:BIuKaWGqxMbmOOqyTztS4tFZliU9cW7lYTYZCFRa++UQ+WRWJHg 1pMoC8X7WBQ5FuN7BB6NijvqgU0bEC1oLzpCbeVTiZs2odvdTcdHDGpkNaWmuPZQtKFK/XF hoFtHwVyalNAbz1wjudDDwjRlhnO/X5hUwIXdOOZdYnGgyEqaAAVFbYUuqo7So/Xb7aaj0p dJUs8/o4mayESigyGvJJQ== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99513 Archived-At: Hello, (CCing the authors of hideshow specified in the file header) in the header of hideshow.el, we have the following paragraph: --8<---------------cut here---------------start------------->8--- ;; Some languages (e.g., Java) are deeply nested, so the normal behavior ;; of `hs-hide-all' (hiding all but top-level blocks) results in very ;; little information shown, which is not very useful. You can use the ;; variable `hs-hide-all-non-comment-function' to implement your idea of ;; what is more useful. For example, the following code shows the next ;; nested level in addition to the top-level: ;; ;; (defun ttn-hs-hide-level-1 () ;; (hs-hide-level 1) ;; (forward-sexp 1)) ;; (setq hs-hide-all-non-comment-function 'ttn-hs-hide-level-1) --8<---------------cut here---------------end--------------->8--- But this doesn't always work. For example, eval the above example in emacs -Q, open "files.el", M-x hs-minor-mode, M-x hs-hide-all. You get an infloop. AFAICT the definition should be (or at least it works with that) (defun ttn-hs-hide-level-1 () (when (hs-looking-at-block-start-p) (hs-hide-level 1)) (forward-sexp 1)) Secondly, there is this comment in `hs-hide-all' which confuses me a bit: ;; Go to end of matched data to prevent from getting stuck ;; with an endless loop. Which match data is meant there? It is either match data from before hiding the block - then it should be documented that `hs-hide-all-non-comment-function' must not change match data, I guess, or the call should be wrapped into `save-match-data'. Or it is even the case that `hs-hide-all-non-comment-function' must set the match data (how?), which then should probably be documented. Thanks, Michael. In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) of 2015-02-15 on drachen Repository revision: ba5bc0ee7c81f2122072bee162fcf1dbd8b2a8f2 Windowing system distributor `The X.Org Foundation', version 11.0.11602901 System Description: Debian GNU/Linux 8.0 (jessie) Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_COLLATE: C value of $LC_TIME: C value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: magit-auto-revert-mode: t rainbow-delimiters-mode: t paredit-mode: t on-screen-global-mode: t ml-scale-mode: t interaction-log-mode: t highlight-defined-mode: t helm-descbinds-mode: t helm-mode: t shell-dirtrack-mode: t helm-occur-match-plugin-mode: t helm-match-plugin-mode: t helm-autoresize-mode: t global-diff-hl-mode: t diff-hl-mode: t diff-auto-refine-mode: t recentf-mode: t which-function-mode: t winner-mode: t show-paren-mode: t auto-image-file-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t mouse-wheel-mode: t prettify-symbols-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t hs-minor-mode: t