Subject: 27.0.50; `not-modified' should be disabled by default

From: Göktuğ Kayaalp <[email-masked]>
Date: Mon, 04 Dec 2017 02:19:45 +0300

I suggest that the command ‘not-modified’, bound by default to ‘M-~’, be
disabled by default, as it can cause data loss and is easily triggered
accidentally, especially with the British keyboard layout where the key
with the apostrophe and the @ sign is adjacent to the key with the
number sign and tilde: Alt+Shift+<apostrophe> becomes M-@ (mark-word),
Alt+Shift+<number sign> becomes M-~ (not-modified).  When Emacs is quit
without further modifying a buffer marked clean with this function, the
changes are lost.  Certainly this scenario is not very probable, but
given that stuff like ‘upcase-region’ is disabled, I thought this one
can get disabled too.  I was nearly bitten by this, and I'd count myself
as a relatively experienced user :)

Find attached a patch disabling this command.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.25)
 of 2017-12-03 built on alpha
Repository revision: 9d7f0e27e0592132c1b5b9c280192333eaf288b8
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description:	Ubuntu 17.10

Recent messages:
next-line: End of buffer
Modification-flag cleared
Saving file /home/g/co/Playground/django/Readme.org...
Wrote /home/g/co/Playground/django/Readme.org
Mark set
Saving file /home/g/co/Playground/django/Readme.org...
Wrote /home/g/co/Playground/django/Readme.org
Type "q" in help window to restore its previous buffer.
Mark set
C-, is undefined [2 times]

Configured using:
 'configure --prefix=/home/g/local --with-x-toolkit=yes --with-modules
 --with-file-notification=yes --without-threads --with-gameuser=no
 --with-mailutils'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES LCMS2

Important settings:
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: tr_TR.UTF-8
  value of $LC_NUMERIC: tr_TR.UTF-8
  value of $LC_TIME: tr_TR.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org

Minor modes in effect:
  diff-auto-refine-mode: t
  auto-image-file-mode: t
  show-paren-mode: t
  persistent-scratch-autosave-mode: t
  winner-mode: t
  global-whitespace-mode: t
  save-place-mode: t
  eval-sexp-fu-flash-mode: t
  url-handler-mode: t
  auto-insert-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-paren-face-mode: t
  global-gk-minor-mode: t
  gk-minor-mode: t
  gk-utf8-entry-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-quote-mode: t
  mouse-wheel-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
  auto-fill-function: org-auto-fill-function
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/g/co/emacs.d/gk/gk-unilat hides /home/g/co/elisp/gk-unilat
/home/g/co/emacs.d/lisp/bsdpkg hides /home/g/co/elisp/bsdpkg
/home/g/co/emacs.d/gk/gk-greek hides /home/g/co/elisp/gk-greek

Features:
(shadow sort vc-filewise mailalias mail-extr emacsbug misearch
multi-isearch cl-print debug info python-django sql view hippie-exp
log-view eieio-opt speedbar sb-image ezimage dframe help-fns radix-tree
dabbrev cl-extra mhtml-mode css-mode color vc-git diff-mode vc-bzr
vc-src vc-sccs vc-svn vc-dir ewoc python tramp-sh pcmpl-unix org-eldoc
org-rmail org-mhe org-irc org-info org-gnus org-docview org-bibtex
bibtex org-bbdb org-w3m dired-aux image-file paren vc-hg init server gk
pass-listing password-store thinks boxquote gk-www gk-feeds gk-urls
elfeed-show elfeed-search elfeed-csv elfeed elfeed-curl elfeed-log
elfeed-db elfeed-lib xml-query gk-ui persistent-scratch pixel-scroll
desktop frameset time ido winner mono-theme elec-pair whitespace
saveplace goto-addr apropos gk-system man gk-multimedia gk-langenvs
gk-turkish gk-ibuffer ibuffer-vc ibuf-ext ibuffer ibuffer-loaddefs
gk-keys multiple-cursors mc-hide-unmatched-lines-mode
mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more
mc-cycle-cursors mc-edit-lines multiple-cursors-core goto-last-change
gk-things gk-programming perl-mode inf-ruby ruby-mode smie js sgml-mode
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs slime-quicklisp slime-xref-browser tree-widget
slime-tramp slime-banner slime-asdf grep slime-mrepl inferior-slime
slime-fancy slime-trace-dialog slime-fontifying-fu slime-package-fu
slime-references slime-compiler-notes-tree slime-scratch
slime-presentations bridge slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl slime-parse slime
arc-mode archive-mode hyperspec scheme gk-outline eval-sexp-fu highlight
inf-lisp highlight-parentheses paredit gk-org org-caldav icalendar
diary-lib diary-loaddefs org-id url-dav url-http url-auth url-gw
url-handlers org-capture autoinsert ob-shell gk-vc vc-rcs vc-cvs vc
vc-dispatcher log-edit pcvs-util add-log ox-groff ox-beamer ox-odt
rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table
ox-ascii ox-publish ox org-eww org-protocol org-mobile org-agenda
gk-org-cite gk-fonts gk-alist gk-mail rx spam spam-stat gnus-uu yenc
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum
gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail tls gnutls utf7
nnoo gnus-spec gnus-int gnus-range gnus-win mail-source smtpmail
sendmail netrc message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 gmm-utils mailheader gk-utils gk-files nsm rmc
tramp-cache tramp tramp-compat tramp-loaddefs trampver parse-time etags
xref project f s ucs-normalize epa-mail epa epg epg-config bbdb-vcard
bbdb-com crm mailabbrev vcard bbdb bbdb-site timezone gk-lingua gk-evil
evil evil-integration undo-tree diff evil-maps evil-commands flyspell
evil-jumps evil-command-window evil-types evil-search evil-ex
evil-macros evil-repeat evil-states evil-core evil-common windmove
thingatpt evil-digraphs evil-vars ace-jump-mode gk-globals forecast
derived subr-x json map solar cal-dst whole-line-or-region paren-face
gk-minor-mode face-remap gk-file gk-mac gk-text zencoding-mode cl
copyright ispell lorem-ipsum gk-utf8 gk-input-methods gk-unilat
gk-syriac gk-greek gk-armenian quail help-mode gk-global-modes eww puny
mm-url gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums mail-utils mm-util mail-prsvr url-queue url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source password-cache url-vars mailcap shr svg
xml seq dom browse-url diminish gk-edit rect gk-documents pdf-sync
pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw eieio byte-opt bytecomp
byte-compile cconv eieio-core eieio-loaddefs mode-local cedet
org-element avl-tree generator org org-macro org-footnote org-pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs find-func cal-menu calendar
cal-loaddefs pdf-outline pdf-links noutline outline easy-mmode
pdf-isearch let-alist pdf-misc imenu pdf-tools compile cus-edit
cus-start cus-load wid-edit pdf-view bookmark pp pdf-cache pdf-info tq
pdf-util advice doc-view jka-compr gk-dired dired-subtree
dired-hacks-utils dash ls-lisp wdired image-dired image-mode format-spec
dired-x easymenu dired dired-loaddefs gk-crypt gk-comint cl-macs shell
pcomplete edmacro kmacro comint ansi-color ring gk-backups cl-seq
cl-loaddefs cl-lib gv time-date mule-util 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 dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 670113 103572)
 (symbols 48 64645 1)
 (miscs 40 3205 3055)
 (strings 32 179959 15217)
 (string-bytes 1 5761193)
 (vectors 16 102310)
 (vector-slots 8 2221053 113258)
 (floats 8 987 1963)
 (intervals 56 9406 112)
 (buffers 992 67))

-- 
İ. Göktuğ Kayaalp	<http://www.gkayaalp.com/>
			 024C 30DD 597D 142B 49AC
			 40EB 465C D949 B101 2427

>From 8044f65e774d3a1640f1f2f67e044ffa75991206 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=B0=2E=20G=C3=B6ktu=C4=9F=20Kayaalp?= <[email-masked]>
Date: Mon, 4 Dec 2017 02:13:25 +0300
Subject: [PATCH] * lisp/files.el (not-modified) Disable this function.

---
 lisp/files.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/files.el b/lisp/files.el
index 205001e5d5..0160ab9939 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5301,6 +5301,8 @@ not-modified
                     "Modification-flag cleared"))
   (set-buffer-modified-p arg))
 
+(put 'not-modified 'disabled t)
+
 (defun toggle-read-only (&optional arg interactive)
   "Change whether this buffer is read-only."
   (declare (obsolete read-only-mode "24.3"))
-- 
2.14.1