Subject: bug#34648: 26.1; emacs-client: gpm-mouse rejected at daemon launch

From: Luc Pierard de Maujouy <[email-masked]>
Date: Tue, 26 Feb 2019 00:13:21 +0000 (UTC)

Le mardi 26 février 2019 à 03:12:07 UTC+3, Luc Pierard de Maujouy <[email-masked]> a écrit :  
 
  I've just tried in .emacs:
(add-hook 'after-make-frame-functions
      (lambda (frame)
        (when (display-graphic-p frame)
          (gpm-mouse-mode t))))
Which does nothing. Switching from when to unless trigger the initial error message.

@ https://bugs.gentoo.org/677826 Gentoo's support noticed: 
The error message is output in function gpm-mouse-start in term.c:

DEFUN ("gpm-mouse-start", Fgpm_mouse_start, Sgpm_mouse_start,
       0, 0, 0,
       doc: /* Open a connection to Gpm.
Gpm-mouse can only be activated for one tty at a time.  */)
  (void)
{
  struct frame *f = SELECTED_FRAME ();
  struct tty_display_info *tty
    = ((f)->output_method == output_termcap
       ? (f)->terminal->display_info.tty : NULL);
  Gpm_Connect connection;

  if (!tty)
    error ("Gpm-mouse only works in the GNU/Linux console");

Debugging with gdb shows that when connected with emacsclient, (f)->output_method is output_initial, while with a standalone Emacs it is output_termcap.
Not sure if the conditional should be changed (to test for output_termcap or output_initial), or if the value of (f)->output_method is wrong.
EOF https://bugs.gentoo.org/677826

My console env:

LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32:*.txt=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
ANDROID_HOME=/opt/android-sdk-update-manager
LANG=fr_FR.utf8
HISTCONTROL= erasedups:ignoreboth
LESS=-R -M --shift 5
OPENGL_PROFILE=xorg-x11
CONFIG_PROTECT_MASK=/etc/sandbox.d /etc/php/cli-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/apache2-php7.2/ext-active/ /etc/fonts/fonts.conf /etc/gentoo-release /etc/gconf /etc/terminfo /etc/dconf /etc/ca-certificates.conf /etc/texmf/web2c /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/revdep-rebuild /etc/splash
EDITOR=nano
PRELINK_PATH_MASK=/usr/lib64/klibc
DISTCC_DIR=/var/tmp/portage/.distcc
GCC_SPECS=
XDG_VTNR=3
XDG_SESSION_ID=29
HUSHLOGIN=FALSE
USER=luc
PAGER=/usr/bin/less
GOPATH=/home/luc/workspace/go
PWD=/home/luc
MANPAGER=manpager
HOME=/home/luc
GSETTINGS_BACKEND=dconf
XDG_DATA_DIRS=/usr/local/share:/usr/share
WINEDLLOVERRIDES=winemenubuilder.exe=d
LADSPA_PATH=/usr/lib64/ladspa
LV2_PATH=/usr/lib64/lv2
CONFIG_PROTECT=/usr/share/gnupg/qualified.txt
SHELL=/bin/bash
TERM=linux
ANDROID_SWT=/usr/share/swt-3.7/lib
SHLVL=1
XDG_SEAT=seat0
MANPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.30/man:/usr/lib/llvm/6/share/man:/usr/lib64/php7.2/man/:/usr/local/share/man:/usr/share/man:/usr/share/rust-bin-1.32.0/man
LOGNAME=luc
XDG_RUNTIME_DIR=/var/run/user/1000
SNOWMIX=/usr/local/lib/Snowmix-0.5.1
XDG_CONFIG_DIRS=/etc/xdg
PATH=/usr/local/heroku/bin:/usr/lib/llvm/6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/bin:/home/luc/workspace/go/bin
INFOPATH=/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.30/info:/usr/share/info:/usr/share/info/emacs-26
XDG_SESSION_COOKIE=asuslpm-1551139030.145530-316395642
LESSOPEN=|lesspipe %s
_=/usr/bin/env
    Le lundi 25 février 2019 à 19:17:08 UTC+3, Eli Zaretskii <[email-masked]> a écrit :  
 
 > Date: Mon, 25 Feb 2019 11:50:57 +0000 (UTC)
> From: Luc Pierard de Maujouy <[email-masked]>
> 
> Starting emacs daemon in console as:
> 
> emacs -u user -chdir /home/user --fg-daemon=emacs.user --debug-init
> 
> outputs:
> 
> Loading t-mouse...
> Loading t-mouse...done
> Error setting gpm-mouse-mode: (error Gpm-mouse only works in the GNU/Linux console)
> Starting Emacs daemon.
> 
> Consequently mouse won't be usable when connecting to daemon, whereas standalone emacs launched in
> console has mouse enabled.

Did you try to set gpm-mouse-mode from after-make-frame-functions
hook?