all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 19892@debbugs.gnu.org
Cc: ttn@gnu.org, dann@ics.uci.edu
Subject: bug#19892: 25.0.50; hideshow: hs-hide-all-non-comment-function example infloop
Date: Tue, 17 Feb 2015 23:45:15 +0100	[thread overview]
Message-ID: <87r3tonon8.fsf@web.de> (raw)


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






             reply	other threads:[~2015-02-17 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 22:45 Michael Heerdegen [this message]
2019-08-02 19:08 ` bug#19892: 25.0.50; hideshow: hs-hide-all-non-comment-function example infloop Lars Ingebrigtsen
2019-08-02 19:17 ` Lars Ingebrigtsen

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=87r3tonon8.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=19892@debbugs.gnu.org \
    --cc=dann@ics.uci.edu \
    --cc=ttn@gnu.org \
    /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.