Subject: Remove Decorations Around Emacs Frame (Windows OS)
From: Arthur Miller <[email-masked]>
To: [email-masked]
Date: Mon, 9 Jan 2017 23:20:14 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I would like to be able to run Emacs without frame decorations on Win
OS. I don't like those since they break visual styles of my Emacs,
especially if I use a dark theme. Also caption bar take some of
vertical screen estate unnecessary. I didn't found any reliable way
to do this from Emacs.

It can be done via Win32 API SetWindowLongPtr by changing EMACS_CLASS
style to WS_POPUP|WS_TABSTOP|WS_VISIBLE. It can be changed back to
original by either saving old style in a variable or by setting
corresponding style bits for standard window frame. I suggest either
to implement this in a "border-width" property when border width
is set to 0, or to implement a new variable/function that can be set in
init file, such as for example "no-frame-borders t". I have made small
prototype/mockup to illustrate what I mean which can be seen on
https://www.youtube.com/watch?v=ii_gTRCuXog

Care has to be taken to note that when removing caption bar and borders
it will be no longer possible to move and resize window unless user
have other means of performing those applications. I am using a small
opensource app called alt-drag (https://stefansundin.github.io/altdrag/).
For convienience one might implement moving/resizing ops in Emacs
window procedure. For ex they can be faked by just sending corresponding
messages
back to wnd proc. I think standard way to do this is by handling
WM_NCHITTEST, as for example:
case WM_NCHITTEST: {
        LRESULT hit = DefWindowProc(hWnd, message, wParam, lParam);
        if (hit == HTCLIENT) hit = HTCAPTION;
        return hit;
    }

Similar could maybe work for HTSIZE but I haven't tested it myself
though, so I can't tell for sure.

In GNU Emacs 26.0.50.1 (x86_64-w64-mingw32)
 of 2017-01-05 built on DESKTOP-EBMFI2K
Repository revision: d88cdad2847726438c7d1de9fd2651c4be9243aa
Windowing system distributor 'Microsoft Corp.', version 10.0.14393
Recent messages:
Wrote c:/Users/Arthur/.emacs
[yas] Prepared just-in-time loading of snippets successfully. [2 times]
Loading c:/Users/Arthur/.emacs.d/plugins/realgud/realgud/common/custom.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/plugins/bookmark-plus/bookmark+-mac.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/plugins/bookmark-plus/bookmark+-mac.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/plugins/bookmark-plus/bookmark+-mac.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/plugins/bookmark-plus/bookmark+-mac.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/plugins/bookmark-plus/bookmark+-mac.el
(source)...done
Loading c:/Users/Arthur/.emacs.d/etc/recentf...done
(Shell command succeeded with no output) [2 times]

Configured using:
 'configure --without-imagemagick --with-modules --without-makeinfo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES

Important settings:
  value of $LANG: SVE
  locale-coding-system: cp1252

Major mode: Emacs-Lisp

Minor modes in effect:
  window-number-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-mode: t
  global-ede-mode: t
  helm-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  async-bytecomp-package-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  override-global-mode: t
  which-function-mode: t
  save-place-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  electric-pair-mode: t
  winner-mode: t
  show-paren-mode: t
  recentf-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Users/Arthur/.emacs.d/plugins/company/company-cmake hides
c:/Users/Arthur/.emacs.d/plugins/company-cmake/company-cmake
c:/Users/Arthur/.emacs.d/plugins/helm/helm hides
c:/Users/Arthur/.emacs.d/plugins/helm-core/helm
c:/Users/Arthur/.emacs.d/plugins/helm/helm-source hides
c:/Users/Arthur/.emacs.d/plugins/helm-core/helm-source
c:/Users/Arthur/.emacs.d/plugins/helm/helm-multi-match hides
c:/Users/Arthur/.emacs.d/plugins/helm-core/helm-multi-match
c:/Users/Arthur/.emacs.d/plugins/helm/helm-lib hides
c:/Users/Arthur/.emacs.d/plugins/helm-core/helm-lib
c:/Users/Arthur/.emacs.d/plugins/load-relative/el-get-install hides
c:/Users/Arthur/.emacs.d/plugins/loc-changes/el-get-install
c:/Users/Arthur/.emacs.d/plugins/load-relative/el-get-install hides
c:/Users/Arthur/.emacs.d/plugins/realgud/el-get-install
c:/Users/Arthur/.emacs.d/plugins/realgud/realgud hides
c:/Users/Arthur/.emacs.d/plugins/xxrealgud/realgud
c:/Users/Arthur/.emacs.d/plugins/loc-changes/test/test-basic hides
c:/Users/Arthur/.emacs.d/plugins/test-simple/test/test-basic

Features:
(shadow flyspell ispell mail-extr emacsbug sendmail helm-command
helm-elisp helm-eval edebug emms-player-simple-mpv-control-functions
emms-player-simple-mpv extras emms-player-vlc emms-player-mplayer
emms-setup emms-librefm-stream emms-librefm-scrobbler
emms-playlist-limit emms-volume emms-volume-amixer emms-i18n
emms-history emms-score emms-stream-info emms-metaplaylist-mode
emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort
emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq
emms-playing-time emms-lyrics emms-url emms-player-simple emms-streams
emms-show-all emms-tag-editor emms-info-metaflac emms-mark
emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-info
later-do emms-playlist-mode emms-source-playlist emms-source-file locate
emms emms-compat ztree ztree-diff ztree-diff-model ztree-dir ztree-view
ztree-util rainbow-delimiters vline sanityinc-solarized-dark-theme
color-theme-sanityinc-solarized neotree dired-xtra direx dired+
image-file bookmark+ bookmark+-key bookmark+-1 gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo gnus-spec gnus-int gnus-range message puny rfc822 mml
mml-sec epa epg epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util
mail-prsvr bookmark+-bmu bookmark+-lit bookmark+-mac ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff
realgud realgud-recursive-autoloads realgud-zshdb
realgud:zshdb-track-mode realgud:zshdb-core realgud:zshdb-init
realgud-trepan3k realgud:trepan3k-track-mode realgud:trepan3k-core
realgud:trepan3k-init realgud-trepan2 realgud:trepan2-track-mode
realgud:trepan2-core realgud:trepan2-init realgud-trepanpl
realgud:trepanpl-track-mode realgud:trepanpl-core realgud:trepanpl-init
realgud-trepanjs realgud:trepanjs-track-mode realgud:trepanjs-core
realgud:trepanjs-init realgud-trepan realgud:trepan-track-mode
realgud:trepan-core realgud:trepan-init realgud-remake
realgud:remake-track-mode realgud:remake-core realgud:remake-init
realgud-rdebug realgud-rdebug-track-mode realgud-rdebug-core
realgud-rdebug-init realgud-perldb realgud:perldb-track-mode
realgud:perldb-core realgud:perldb-init realgud-lang-perl realgud-pdb
realgud:pdb-track-mode realgud:pdb-core realgud:pdb-init realgud-nodejs
realgud:nodejs-track-mode realgud:nodejs-core realgud:nodejs-init
realgud-lang-js realgud-kshdb realgud:kshdb-track-mode
realgud:kshdb-core realgud:kshdb-init realgud-jdb realgud:jdb-track-mode
realgud-lang-ruby realgud:jdb-core realgud:jdb-init gud realgud-ipdb
realgud:ipdb-track-mode realgud:ipdb-core realgud:ipdb-init
realgud-lang-python realgud-gub realgud:gub-track-mode realgud:gub-core
realgud:gub-init realgud-gdb realgud:gdb-track-mode realgud:gdb-init
realgud:gdb-core realgud-bashdb realgud:bashdb-track-mode
realgud:bashdb-core realgud:bashdb-init realgud-lang-posix-shell
realgud:run realgud-track-mode realgud-backtrace-mode realgud-track
realgud-shortkey realgud-menu realgud-eval realgud-cmds realgud-send
realgud-window realgud-utils realgud-init realgud-file esh-var esh-io
esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module
esh-util esh-mode realgud-core realgud-reset realgud-buffer-helper
realgud-buffer-backtrace realgud-buffer-command realgud-buffer-info
realgud-regexp realgud-lochist the-org-mode-expansions org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs realgud-bp
realgud-bp-image-data realgud-loc realgud-buffer-source realgud-key
realgud-custom key realgud-follow realgud-lang realgud-fringe
realgud-helper test-simple loc-changes load-relative company avy
window-number thing-edit sr-speedbar semantic/db-mode semantic/db
semantic/idle semantic/ctxt semantic/sb semantic/sort semantic/format
semantic/tag-ls semantic/find semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local find-func ede/speedbar
ede/files ede ede/detect ede/base ede/auto ede/source eieio-base
eieio-speedbar speedbar sb-image ezimage dframe eieio-custom cedet
indent-guide helm-gtags pulse ggtags ewoc helm-descbinds helm-mode
helm-files rx image-dired image-mode tramp tramp-compat tramp-loaddefs
trampver ucs-normalize shell pcomplete parse-time format-spec dired-x
dired-aux ffap helm-buffers helm-elscreen helm-tags helm-bookmark
helm-adaptive helm-info info bookmark pp helm-locate helm-grep
helm-regexp helm-external helm-net xml url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
helm-utils helm-help helm-types helm helm-source eieio-compat
helm-multi-match helm-lib dired dired-loaddefs helm-config
helm-autoloads helm-easymenu async-bytecomp flymake compile comint
ansi-color auto-complete-config auto-complete popup autopair
fill-column-indicator js2-mode-expansions js2-mode etags xref project
js-mode-expansions js html-mode-expansions sgml-mode subr-x dom json map
seq cc-mode-expansions cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs yasnippet expand-region
text-mode-expansions er-basic-expansions thingatpt expand-region-core
expand-region-custom undo-tree derived edmacro kmacro diff cl
smart-mode-line advice rich-minority speck async bind-key easy-mmode
diminish misearch multi-isearch add-log browse-url url-util url-parse
auth-source cl-seq eieio byte-opt bytecomp byte-compile cl-extra
help-mode cconv eieio-core cl-macs gv eieio-loaddefs password-cache
url-vars server warnings which-func imenu saveplace autorevert
filenotify hl-line elec-pair winner ring paren time-date recentf
tree-widget wid-edit cl-loaddefs pcase cl-lib easymenu mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
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
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 w32notify w32 multi-tty
make-network-process emacs)

Memory information:
((conses 16 793703 34966)
 (symbols 56 60903 3)
 (miscs 48 166 213)
 (strings 32 132076 15794)
 (string-bytes 1 4760642)
 (vectors 16 81947)
 (vector-slots 8 1290395 16246)
 (floats 8 1646 412)
 (intervals 56 1557 50)
 (buffers 976 17))