;;; -*-Mode: emacs-lisp; Coding: emacs-mule; fill-column: 100-*- ;;; This file is executable and shows some problems indicated below. Execution is addressed further ;;; down. The generating OS, etc. information is at the end of this file. ;;; Background information: I am updating from emacs 23.2 running on Trisquel 5.0, to 25.1 running ;;; on Mint 18.1 and Trisquel 7. So I have jumped over v24. I have over 50K lines of elisp that ;;; have run successfully for over 20 years. I have modified, extended, and updated the code over ;;; the years as necessary, but the code still is basically the original. 23.2 on Trisquel has been ;;; great, but I am sure that you will understand the need to get up to date with OS and emacs. ;;; Also, I hope that you understand that it is important to me to keep my software running ;;; correctly. ;;; Regrettably, 25.1 does not support my code very well, this is in contrast to 23.2, and, really, ;;; all previous versions dating back at least to v19, where it does work well. I am trying to ;;; solve the problems, currently there are two of them that are serious from my point of view, and ;;; one other that is a nuisance. ;;; The first problem is that 25.1 does not position a new frame correctly unless the frame is ;;; visible when created. Starting with a visible frame is tacky because of the flashing that ;;; results. Command simple-doit-1 demonstrates this, see below for notes on execution. ;;; I spent a lot of time looking in the wrong places for a bug, but have concluded that the problem ;;; is more of a design issue. I think that I have identified what is happening, but I leave that ;;; to you to judge. The problem appears at xterm.c:10971, and is alluded to in window.c:2335-2340. ;;; This is from window.c ;;; /* Yuck!! If we've just created the frame and the ;;; window-manager requested the user to place it ;;; manually, the window may still not be considered ;;; `visible'. I'd argue it should be at least ;;; something like `iconified', but don't know how to do ;;; that yet. --Stef */ ;;; This is part of x_make_frame_visible at line xterm.c:10963 ;;; Don't do this if the window has never been visible before, ;;; because the window manager may choose the position ;;; and we don't want to override it. */ ;;; ;;; if (! FRAME_VISIBLE_P (f) ;;; && ! FRAME_ICONIFIED_P (f) ;;; && ! FRAME_X_EMBEDDED_P (f) ;;; && f->win_gravity == NorthWestGravity ;;; && previously_visible) ;;; So, my case is that I create a frame and want to position it before I make it visible, this is ;;; nothing to do with the window manager. I can solve the problem by eliminating the ;;; "previously_visible" part of the test above, and I am doing that as a temporary get-around. ;;; But, of course, that elimination cuts across your window manager concern. ;;; The second problem concerns user input, as is required in the current file. The (discard-input) ;;; code immediately before the read-event in simple-doit-1, and which has not been necessary with ;;; previous versions of emacs, has a disadvantage whether or not it is in place. If it is not ;;; there (you need to comment the line to see this effect), the effect can be something like key ;;; bounce, and this can be seen when the first text appears in the popup: two text lines may ;;; appear, instead of one. If (discard-input) is in the code, the performance is better, but if a ;;; series of key entries must be made, a requirement in my code, then the user must consciously ;;; pause between key entries. This is a user-nuisance kind of problem. ;;; An additional facet of this problem is that it does not always manifest itself. Thus, ;;; sometimes, you will not see the two text lines appear together without obvious input. This ;;; second problem is described here for information, you may or may not be able to reproduce it. ;;; Either way it is a degradation of performance of emacs. This problem has appeared in my code's ;;; performance in the change between 23.2 and 25.1. ;;; The third problem was to have been demonstrated with another command, but I have been unable to ;;; reproduce the problem in a simple function. The problem is a sometime occurring, ;;; display-wrecking, problem. I wonder if it is not even an emacs problem, but due to underlying ;;; rendering library code. The problem is repeatable. Also, it is new in 25.1 compared with 23.2. ;;; What I have done is take a screen shot showing the problem, a .jpg image is attached, the screen ;;; shot is cropped. What is shown is two frames, the green frame is a frame generated by executing ;;; code (similar to simple-doit-1, but considerably more complicated), the cream frame is the main ;;; emacs frame. The black is the xterm background. The frame windows are displaying the same ;;; buffer, at the same time, normally these displays are identical because the buffer is the same. ;;; The green frame in the image shows a distorted text display, this frame always is correctly ;;; sized for the correct text. The break at the sixty-first column is repeatable, but other ;;; displays break at other places. ;;; I realize that solving this problem may be, at least, very difficult. I am hoping that you have ;;; some insight into the how and why. I am simply letting you know that what is happening, and it ;;; is new, after twenty-odd years. ;;; To run this code, first check the lines immediately below to understand what they do, and modify ;;; the binding if desired. Then, evaluate the file, press the bound key, and follow the ;;; instructions in the echo area, pressing any key several times until the left value (shown in the ;;; popup as l:-NN) goes positive. The problem is the first display of the popup. Next, change the ;;; value of the visibility switch below, re-evaluate. and repeat the key press, etc. ;; Change to see different performance under 25.1 (also 24.5, I checked 24.5 at some point). (defconst simple-visibility 'nil) ;; Binding. Change as required. (global-set-key [f11] 'simple-doit-1) ;; A service variable. (defvar .emacs-current-emacs-version (let ((lead-in "GNU Emacs ") ; an assumption, correct for 23.2, 24.5, and 25.1 (dot "\\.") (version (emacs-version)) (dummy "NOT INITIALIZED")) (setq dummy (substring version (length lead-in))) (substring dummy 0 (string-match dot dummy (1+ (string-match dot dummy))) )) "The current emacs version, as a string, with format NN.N") (defun simple-doit-1 () "Tests frame sizing and positioning." (interactive) (let ((simple-frame (make-frame `((name . "Simple Frame") (visibility . ,simple-visibility))) ) (simple-buffer (get-buffer-create "Simple Buffer"))) (set-window-buffer (frame-selected-window simple-frame) simple-buffer) (with-current-buffer simple-buffer (erase-buffer) (insert (format "version %s" .emacs-current-emacs-version))) (let* ((invoking-frame (selected-frame)) (newish (<= 25.1 (string-to-number .emacs-current-emacs-version))) (invoke-origin (if newish (frame-position invoking-frame) '(0 . 25))) (invoke-left (car invoke-origin)) (invoke-top (cdr invoke-origin)) (left -41) (top invoke-top) (width 60) (height 6)) (unwind-protect (while (progn (set-frame-size simple-frame width height) (set-frame-position simple-frame left top) (select-frame-set-input-focus simple-frame) (set-buffer simple-buffer) (goto-char (point-max)) (insert (format "\n%s l:%3d t:%3d w:%3d h:%3d" (selected-frame) left top width height)) (setq left (+ left 10) top (+ top 10) height (+ height 1)) ;;; (if newish (discard-input)) ;; loop test (not (equal (read-event "press any key to continue, escape to terminate") 'escape))) ) ;; end no body while ;; Protected. (select-frame invoking-frame) (delete-frame simple-frame))) )) ;;; The End. ;;; david@ngdr.net ;;; 2 March 2017 ;;; In GNU Emacs 25.1.13 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9) ;;; of 2017-02-25 built on Erota ;;; Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 ;;; System Description: Linux Mint 18.1 Serena ;;; ;;; Configured using: ;;; 'configure CFLAGS=-g' ;;; ;;; Configured features: ;;; XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY FREETYPE XFT ZLIB ;;; TOOLKIT_SCROLL_BARS GTK3 X11 ;;; ;;; Important settings: ;;; value of $LANG: en_US.UTF-8 ;;; locale-coding-system: utf-8-unix ;;; ;;; Major mode: Info ;;; ;;; Minor modes in effect: ;;; display-time-mode: t ;;; show-paren-mode: t ;;; shell-dirtrack-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 ;;; 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 ;;; buffer-read-only: t ;;; column-number-mode: t ;;; line-number-mode: t ;;; transient-mark-mode: t ;;; Load-path shadows: ;;; None found. ;;; ;;; Features: ;;; (shadow sort mail-extr emacsbug message 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 browse-url ispell ;;; image-mode sh-script smie executable sgml-mode cl-extra cc-mode ;;; cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine ;;; cc-vars cc-defs dabbrev misearch multi-isearch mailalias sendmail ;;; rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode mail-prsvr ;;; mail-utils advice effective-impressive-communications Favourites ;;; fileset-Web fileset-Emacs25 fileset-Nepenthes fileset-VTrack ;;; fileset-NDM Local-filesets MinorTools time paren Load-Nepenthes ;;; Load-Environ MoreTools fileset-NavigationShellExtensionsCompilable ;;; fileset-NavigationShellKernelCompilable ConfigViews MaintenanceHelp ;;; FileProcessing ExtendedHelp DocumentMap Spawn ManInfo Logging ;;; GenericTools Fileset tex-mode shell pcomplete makeinfo texinfo compile ;;; comint ansi-color ring Common Maintenance SearchAndMod Path-Environ ;;; Load-NavigationShell FixupKeymaps Texinfo NewFile find-func ;;; HelpAtPoint Customize ToolsHelp noutline outline easy-mmode Tools ;;; ModeChange ModeChangeHelp NavShellHelp KeyDisplayEdit KeyDisplayHelp ;;; EmacsHelp dired NavigationShell PopEdit KeyDisplay Path-NavShell info ;;; speedbar sb-image ezimage dframe derived easymenu cl-macs gv ;;; cl-loaddefs pcase cl-lib Basis 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 inotify dynamic-setting system-font-setting ;;; font-render-setting move-toolbar gtk x-toolkit x multi-tty ;;; make-network-process emacs) ;;; ;;; Memory information: ;;; ((conses 16 307931 161132) ;;; (symbols 48 29413 0) ;;; (miscs 40 323 2286) ;;; (strings 32 48593 29093) ;;; (string-bytes 1 1599176) ;;; (vectors 16 20546) ;;; (vector-slots 8 568963 16849) ;;; (floats 8 292 1019) ;;; (intervals 56 10070 3360) ;;; (buffers 976 157) ;;; (heap 1024 437759 51414))