Subject: 25.2; c-mode narrow-to-region broken

From: Gordon Ross <[email-masked]>
Date: Thu, 1 Jun 2017 21:17:16 -0400

I often use "narrow-to-region" in c-mode when I want to do something
like replace-string but just within the bounds of one C function or
(in the example represented in this bug report) the entirety of one
switch statement starting with switch (expr) { ... ending with }

After my recent upgrade to emacs 25.2, the TAB "auto-indent" feature
usually doesn't work in such a narrowed region, briefly showing
complaints in the minibuffer (See "Args out of range" in messages
section below) and not indenting.

In GNU Emacs 25.2.1 (i386-pc-solaris2.11, GTK+ Version 2.24.30)
 of 2017-04-25 built on hipster.openindiana.org
Windowing system distributor 'Project OpenIndiana', version 11.0.11804000
Configured using:
 'configure CC=/usr/gcc/4.9/bin/gcc CXX=/usr/gcc/4.9/bin/g++
 F77=/usr/gcc/4.9/bin/gfortran FC=/usr/gcc/4.9/bin/gfortran 'CFLAGS=-m32
 -O3 ' 'CXXFLAGS= -m32' 'FFLAGS= -m32' FCFLAGS=-m32 'LDFLAGS=-m32
 -L/usr/gnu/lib -R/usr/gnu/lib'
 PKG_CONFIG_PATH=/usr/lib/pkgconfig/gnutls-3:/usr/lib/pkgconfig
 --prefix=/usr --mandir=/usr/share/man --bindir=/usr/bin
 --libdir=/usr/lib --sbindir=/usr/sbin --infodir=/usr/share/info
 --with-compress-info=no --datarootdir=/usr/share --libexecdir=/usr/lib
 --with-gif=no ac_cv_sys_long_file_names=yes --with-x-toolkit=gtk2'

Configured features:
XPM JPEG TIFF PNG RSVG IMAGEMAGICK DBUS GCONF GSETTINGS NOTIFY ACL
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11

Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: C
  value of $LC_CTYPE: C
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: C
  value of $LC_NUMERIC: C
  value of $LC_TIME: C
  value of $LANG: C
  locale-coding-system: nil

Major mode: C/l

Minor modes in effect:
  diff-auto-refine-mode: t
  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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent messages:
Quit
Auto-saving...done
Saving file foo.c...
Wrote foo.c
Making completion list...
Mark set
Quit
c-determine-limit: Args out of range: #<buffer smb_cmn_oplock.c>, 15565, 17393
Quit
Type C-x 1 to remove help window.
scroll-down-command: Beginning of buffer
You can run the command ‘emacs-version’ with M-x em-v RET
GNU Emacs 25.2.1 (i386-pc-solaris2.11, GTK+ Version 2.24.30) of 2017-04-25

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message idna format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr
mail-utils misearch multi-isearch compare-w vc-git diff-mode easy-mmode
cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds dired ls-lisp
cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs pcase cl-lib
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core 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 charscript case-table epa-hook
jka-cmpr-hook help simple abbrev 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 dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 8 129503 30266)
 (symbols 24 22533 0)
 (miscs 20 185 1142)
 (strings 16 23076 7101)
 (string-bytes 1 879457)
 (vectors 8 18343)
 (vector-slots 4 910844 5292)
 (floats 8 181 421)
 (intervals 28 3452 1741)
 (buffers 520 27))