Use the following example source code: module test_mod implicit none contains subroutine a() end subroutine a subroutine b() end subroutine b subroutine c() end subroutine c subroutine d() end subroutine d end module test_mod enable hide-show-mode (hs-minor-mode) and execute command hs-hide-level when cursor is outside of any subroutine. The result is that only every other subroutine gets hidden. This can be also reproduced with emacs 23.2.1 (debian-stable). In GNU Emacs 24.0.95.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of 2012-04-17 on sommerfeld Windowing system distributor `The X.Org Foundation', version 11.0.10707000 Configured using: `configure '--prefix=/home/p0friedr/a_dait01/local/emacs'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: de_DE.utf8 value of $LANG: en_US.utf8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: F90 Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-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 line-number-mode: t transient-mark-mode: t hs-minor-mode: t Recent input: C-x C-f p r o j h i C-g C-x C-f t m p . f 9 0 i m o d u l e SPC t e s t _ m o d i i m p l i c i t SPC n o n e c o n t a i n s i s u b r o u t i n e SPC a ( ) e n d s u r b r o u t i n e SPC b ( ) e n d d d s u b r o u t i n e SPC c ( ) e n d s u r b r o u t i n e SPC d ( ) e n d u u e n d M-x h s - m i n o M-x h s - h i l C-SPC C-w C-y M-x M-x r e p o Recent messages: Inserting d. Inserting subroutine. Inserting d. Inserting module. Inserting test_mod. Hs minor mode enabled Hiding blocks ... done You can run the command `hs-hide-level' with C-c @ C-l Mark set [2 times] Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode view hideshow vc-dispatcher vc-svn f90 cus-edit easymenu cus-start cus-load wid-edit time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)