bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44042: 26.3; `end-of-defun', `narrow-to-defun' broken for f90-mode


From: Klaus-Dieter Bauer
Subject: bug#44042: 26.3; `end-of-defun', `narrow-to-defun' broken for f90-mode
Date: Fri, 16 Oct 2020 22:29:25 +0200

In `f90-mode', using `narrow-do-defun' will keep the buffer up until the
end of the module.

The cause seems to be that `f90-end-of-subprogram', which is called by
`end-of-defun', considers the whole `SUBROUTINE' line to be part of the
outer scope.

Within `narrow-to-defun', the function `end-of-defun' is called when the
point is at the beginning of the `SUBROUTINE' line, which moves `point'
to the end of the scope where the subroutine is declared instead of to
the end of the subroutine.

To reproduce in `emacs -Q':

1.  Create a file `test.f90' with the following contents:
    ________________________________________
    01:  module main
    02:  contains
    03:
    04:    subroutine parentscope()
    05:
    06:    contains
    07:
    08:      subroutine helloworld ()
    09:        print *, "hello world"  !<- narrow-to-defun on this line
    10:      end subroutine helloworld
    11:
    12:      subroutine byeworld ()
    13:        print *, "bye world"
    14:      end subroutine byeworld
    15:
    16:    end subroutine parentscope
    17:
    18:  end module main
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.  On the line `print *, "hello world"' perform `C-x n d' or `M-x
    narrow-to-defun'. We expect narrowing to
    ________________________________________
    08:      subroutine helloworld ()
    09:        print *, "hello world"
    10:      end subroutine helloworld
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    but instead get narrowing to
    ________________________________________
    08:      subroutine helloworld ()
    09:        print *, "hello world"
    10:      end subroutine helloworld
    11:
    12:      subroutine byeworld ()
    13:        print *, "bye world"
    14:      end subroutine byeworld
    15:
    16:    end subroutine parentscope
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


--------------------------------------------------
In GNU Emacs 26.3 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.22.30)
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description:	openSUSE Leap 15.1

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --disable-build-details --with-pop --without-hesiod
 --with-gameuser=:games --with-kerberos --with-kerberos5
 --with-file-notification=inotify --with-modules --enable-autodepend
 --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
 --datadir=/usr/share --localstatedir=/var --sharedstatedir=/var/lib
 --libexecdir=/usr/lib
 --enable-locallisppath=/usr/share/emacs/26.3/site-lisp:/usr/share/emacs/site-lisp
 --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff
 --with-gif --with-png --with-rsvg --with-dbus --with-xft --without-gpm
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 --x-includes=/usr/include --x-libraries=/usr/lib64 --with-libotf
 --with-m17n-flt --with-xwidgets --build=x86_64-suse-linux
 'CFLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall
 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables
 -fasynchronous-unwind-tables -fstack-clash-protection -D_GNU_SOURCE
 -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS
 -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label
 -fno-optimize-sibling-calls -fno-PIE -DSYSTEM_PURESIZE_EXTRA=55000
 -DSITELOAD_PURESIZE_EXTRA=10000 ' LDFLAGS=-Wl,-O2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS GLIB NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD

Important settings:
  value of $LC_MONETARY:
  value of $LC_NUMERIC: POSIX
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix

Major mode: F90

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils f90 cus-edit easymenu cus-start pcase
cus-load wid-edit cl-loaddefs cl-lib elec-pair time-date mule-util
delsel lpr tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting
xwidget-internal move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 117032 6902)
 (symbols 48 22191 2)
 (miscs 40 94 115)
 (strings 32 32999 1225)
 (string-bytes 1 882572)
 (vectors 16 15808)
 (vector-slots 8 518667 8698)
 (floats 8 57 67)
 (intervals 56 328 0)
 (buffers 992 13))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]