Subject: bug#65349: 29.1; "setq-default indent-tabs-mode nil" seem to be ignored

From: håkan engblom <[email-masked]>
Date: Thu, 17 Aug 2023 14:09:26 +0200

--text follows this line--

<https://stackoverflow.com/posts/76921083/timeline>

I'm using Ubuntu 20.04 and the emacs version is:

GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo
version 1.16.0) of 2023-08-04

as seen when I look the emacs-menu help->About Emacs

In my .emacs file this line is present:

(setq-default indent-tabs-mode nil)

which, as far as I understand, shall make the default setting of this
variable (indent-tabs-mode) to be disabled, i.e. instead of inserting a tab
in the code-file, it shall insert a number of spaces, four to be exact,
according to this line in .emacs:

(setq-default tab-width 4)

This is what I want, and it has worked fine until recently. What I get now
is that emacs insert a tab (\t) character instead. I suspect that it broke
during some upgrade of emacs, judging from the build date of emacs it is
updated recently, 2023-08-04

Further, if I disable the variable locally (M-x indent-tabs-mode) in a
buffer it works, then I get four spaces, but the variable has to be
modified manually in every buffer I start.

I've also tried moving the (setq-default indent-tabs-mode nil) to the last
line in .emacs, if the variable was "implicitly overwritten" by some other
directive in the .emacs file. It had no effect.

So it seems to me the problem is that the default setting of this variable
is ignored.
My complete .emacs is at the end.

br Hakan

In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
 cairo version 1.16.0) of 2023-08-04 built on bos03-amd64-031
Repository revision: cf57ec68c2a5ac5b721f445928869ca14232a4d1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.6 LTS

Configured using:
 'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
 --without-xaw3d --with-modules --with-cairo
 --with-native-compilation=aot --with-xinput2 --with-tree-sitter
 --with-json
 'CFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
 -isystem/build/emacs/stage/usr/include -O2'
 'CPPFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
 -isystem/build/emacs/stage/usr/include'
 'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
 -L/build/emacs/parts/emacs/install/usr/lib
 -L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
 -L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu
 -L/build/emacs/stage/usr/lib''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

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

Major mode: ELisp/d

Minor modes in effect:
  global-company-mode: t
  company-mode: t
  delete-selection-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils misearch multi-isearch
time-date company-oddmuse company-keywords company-etags etags fileloop
generator xref project ring company-gtags company-dabbrev-code
company-dabbrev company-files company-clang company-capf company-cmake
company-semantic company-template company-bbdb company edmacro kmacro
pcase cc-styles cc-align cc-engine cc-vars cc-defs delsel cua-base
cus-load site-start comp comp-cstr warnings icons rx cl-extra help-mode
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 148609 10378)
 (symbols 48 12035 0)
 (strings 32 37190 2521)
 (string-bytes 1 1373628)
 (vectors 16 24041)
 (vector-slots 8 473147 20664)
 (floats 8 62 241)
 (intervals 56 968 0)
 (buffers 984 15))

My .emacs:

(setq package-archives
  '( ;;("gnu" . "http://elpa.gnu.org/packages/")
    ;;("marmalade" . "https://marmalade-repo.org/packages/")
    ("melpa" . "https://melpa.org/packages/")))

;; For auto-complete:
;; Requires installing company-mode:
(add-hook 'after-init-hook 'global-company-mode)

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(cursor ((t (:background "lightgreen" :foreground "black"))))
 '(font-lock-builtin-face ((t (:foreground "SpringGreen4" :weight bold))))
 '(font-lock-comment-face ((t (:foreground "SlateGrey"))))
 '(font-lock-constant-face ((t (:foreground "LawnGreen"))))
 '(font-lock-function-name-face ((t (:foreground "Light Green" :weight
bold))))
 '(font-lock-keyword-face ((t (:foreground "Green" :weight bold))))
 '(font-lock-preprocessor-face ((t (:foreground "DarkOrange"))))
 '(font-lock-type-face ((t (:foreground "MediumSpringGreen"))))
 '(font-lock-variable-name-face ((t (:foreground "LimeGreen"))))
 '(highlight ((((class color) (background dark)) (:background
"DarkSlateGray")))))
;; '(font-lock-function-name-face ((((class color) (background dark))
(:foreground "LightSkyBlue" :weight bold))))
;; '(font-lock-keyword-face ((((class color) (background dark))
(:foreground "Cyan" :weight bold)))))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(case-fold-search t)
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(current-language-environment "Latin-1")
 '(default-input-method "latin-1-prefix")
 '(delete-selection-mode t nil (delsel))
 '(global-font-lock-mode t nil (font-lock))
 '(package-selected-packages '(rust-mode zygospore company))
 '(pc-selection-mode t)
 '(scroll-bar-mode 'right)
 '(show-paren-mode t nil (paren))
 '(tags-revert-without-query t))

;; Create my own C style
(defconst my-c-style '(
                       (c-basic-offset . 4)
                       (c-comment-only-line-offset 0 . 0)
                       (c-offsets-alist
                        (statement-block-intro . +)
                        (knr-argdecl-intro . 5)
                        (substatement-open . 0)
                        (label . 0)
                        (case-label . +)
                        (statement-case-open . +)
                        (statement-case-intro . +)
                        (statement-cont . +)
                        (arglist-intro . c-lineup-arglist-intro-after-paren)
                        (arglist-close . c-lineup-arglist)
                        (inline-open . 0))
                       (c-special-indent-hook . c-gnu-impose-minimum)
                       (c-comment-continuation-stars . "")
                       (c-hanging-comment-ender-p . t))
  )

;; add the new C style
(c-add-style "PERSONAL" my-c-style )

(add-hook 'c-mode-hook
 (lambda ()
            (c-set-style "PERSONAL")))

(add-hook 'c-mode-hook
          (lambda ()
            (c-set-style "linux")))

;; ===== Set the highlight current line minor mode =====

;; In every buffer, the line which contains the cursor will be fully
;; highlighted

;;(global-hl-line-mode 1)

;; ========== Line by line scrolling ==========

;; This makes the buffer scroll by only a single line when the up or
;; down cursor keys push the cursor (tool-bar-mode) outside the
;; buffer. The standard emacs behaviour is to reposition the cursor in
;; the center of the screen, but this can make the scrolling confusing

(setq scroll-step 1)

;; ========== Support Wheel Mouse Scrolling ==========

(mouse-wheel-mode t)

(global-set-key (kbd "C-%") 'match-paren)
    (defun match-paren (arg)
      "Go to the matching paren if on a paren; otherwise insert %."
      (interactive "p")
      (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
            ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
            (t (self-insert-command (or arg 1)))))

(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)
(set-background-color "black")
(set-foreground-color "ForestGreen")
(set-cursor-color  "lightgreen")

(global-unset-key "\347")
(global-unset-key "\347b")
(global-unset-key "\347d")
(global-unset-key "\347i")
(global-unset-key "\347l")
(global-unset-key "\347u")
(global-unset-key "\347o")
(global-unset-key "\347 ")

(global-set-key "\347" (quote goto-line))

;(set-face-font 'default
"-*-courier-medium-r-normal-*-64-*-*-*-*-*-iso8859-1")

(put 'upcase-region 'disabled nil)

;; ========== Automatically re-visit TAGS file if changed ==========
(setq tags-revert-without-query t)
;;BEGIN JDE/2.2.4 DON'T REMOVE -- INSERTED BY MODULE

;;(add-to-list 'load-path(expand-file-name "/app/jde/2.2.4"))

;;(add-to-list 'load-path(expand-file-name "/app/jde/semantic"))

;;(add-to-list 'load-path(expand-file-name "/app/jde/speedbar"))

;;(add-to-list 'load-path(expand-file-name "/app/jde/eieio"))

;;(add-to-list 'load-path(expand-file-name "/app/jde/elib"))

;;(require 'jde)

;;END JDE/2.2.4

(setq-default tab-width 4)
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-selection-value)
;;(set-default-font "Monospace-9")
(setq company-idle-delay 0.2)
(setq company-minimum-prefix-length 2)
(global-company-mode t)

(define-key global-map "\M-n" 'pop-tag-mark)
(setq-default indent-tabs-mode nil)