On 9/27/23 05:53, Corwin Brust wrote:
Hi David

On Tue, Sep 26, 2023 at 3:06 PM David Hedlund <public@beloved.name> wrote:

On 9/26/23 21:11, Emanuel Berg wrote:

David Hedlund wrote:

So my original email suggest a complete solution, is this
something we can add to a new page,
https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html
and then update it with improved solutions in the future?

AFAIK the HTML pages representing the online Emacs manual are defined
within the sources for the manual, itself.  IOW, to add a "page" for
this would entail creating a new manual section, at which the new page
would appear when new HTML versions of the manual are published, along
with some subsequent release of Emacs (say, the next major version, if
the change was made in the development branch).


Thank you!



Subject URL was new for me if nothing else :P

Methods to always maximize `emacs` (for example, from Alt+F2 in MATE), without the slightly distracting visual effect when the default frame size is growing to fullscreen. The window will be maximized quickly, like "emacs --maximize".

This seems like very helpful information.  As a precursor --or even an
alternative-- to proposing a patch to the manual to provide these
examples, what would you think of adding this into the EmacsWiki?   I
believe it is not unheard of to link from the manual to EmacsWiki,
thus you could potentially simplify the patch involved by proposing
adding some minimal explanation and a link (rather than
providing/motivating a patch adding -e.g.- a section).

As far as I know, the devilspie2/.emacs solution that I figured out, is the only way to make emacs behave like `emacs -mm` right now. Both of them will:

* Always run the settings regardless how emacs is opened (e.g. Alt+F2 in MATE) despite that an external program (devilspie2) is used.

* The buffer will:

** Expand automatically when emacs opens

** Expand quickly like `emacs -mm`

* Like `emacs -mm`, the size of ~/.emacs does not impact the time it takes to expand the buffer.

This makes the devilspie2 solution unique, since all solutions at https://www.emacswiki.org/emacs/FullScreen makes the buffer expand slowly. That's why I suggest that we should add my devilspie2/.emacs solution to https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html



GNU/Linux - proposed new section: https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html


As far as I know, this cannot be done entirely with Emacs LISP for GNU/Linux, but I found a workaround by combining it with devilspie2.


I've successfully used this recipe for Trisquel 11:

* Step 1 to quickly maximize the window[1]: Install, configure, and autostart devilspie2 to nearly maximize emacs[1]. Run this in a terminal or as a script:

# Install devilspie2
sudo apt-get -y install devilspie2

# Configure devilspie2
mkdir -p ~/.config/devilspie2/

width="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)"
height="$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)"

tee ~/.config/devilspie2/emacs.lua /dev/null << EOF
if (get_class_instance_name() == "emacs") then

    set_window_geometry(0, 0, $width, $height);

end
EOF

# Autostart devilspie2
mkdir -p "$HOME/.config/autostart/" # The directory does not exist by default
cd "$HOME/.config/autostart/" || exit
file="devilspie-2.desktop"
touch "$file"
desktop-file-edit \
--set-name="Devilspie 2" \
--set-comment="Perform scripted actions on windows as they are created" \
--set-key="Type" --set-value="Application" \
--set-key="Exec" --set-value="devilspie2" \
--set-key="X-MATE-Autostart-Delay" --set-value="0" \
"$file"
desktop-file-validate "$file"

* Step 2 to quickly maximize the window[1]: Add this to ~/.emacs: (add-to-list 'default-frame-alist '(fullscreen . maximized))
* Log out and then log back into your desktop environment
* Every time you open `emacs`, regardless how you are opening it, it will open the window equally fast as `emacs --maximize`

[1]: Workaround to bug: maximize* commands don't work for Emacs - https://savannah.nongnu.org/bugs/index.php?63979



The above steps can of course be rewritten and described for general use to make it useful for any GNU/Linux distro.
Thanks for figuring all this out!

Corwin