GUI/Terminal Emacs behave differently - same config

Up until now I’ve primarily been using terminal emacs because much of my initial use case was remote command-line editing over a slow connection.

I’d like to use GUI emacs but I’ve discovered it behaves differently than my terminal emacs despite sharing the same init.el.

The most immediate difference when I invoke find file with C-c C-f the <tab> key literally inserts a tab into the minibuffer instead of incremental completion of the file path.

GUI - <TAB>:


Note: Please ignore the [s-w is undefine] this is just a by-product of me trying to get the screen grab at the correct instant to show the point’s position.

Terminal <TAB> (actually double tab to pop the vertical list):
image

It seems to want <RET> for completions but not incremental ones, it proceeds immediately to executing the nearest match.

It is totally non-obvious to me why the GUI and terminal emacs behave differently like this or how to go about determining the culprit.

I’m not explicitly setting any mini-buffer modes or completion frameworks or even a key for mini-buffer completion in my init.el.

As with your last post (Org-capture error's MSWindows) it’s hard to tell what is happening without a complete, self-contained init.el. Also, last time you posted you used Emacs on Windows, but this seems like a Linux distribution.

Please post a init.el that reproduces the issue, and try to make it as minimal as possible (e.g. remove as much as you can, especially third-party packages), otherwise it will be hard to check why that happens.

(For completeness, I took your last posted init.el and was not able to reproduce the issue - but then again, I could not properly load your init.el because it does not work without lots of interaction)

Ahhh, I apologize. I was in a rush writing the post and thought I left this a draft but I guess I posted it :grimacing:

You are correct that the system I am referring to here is a Linux system. The other system I have posted about previously is for work and thus MSWindows.

I have actually taken your advice from that previous thread and refactored both systems to use-package.

Now! In the process of trimming down my init.el to post it to this thread I found the culprit:

I was doing this - overriding the global key map for <tab>

(use-package company                               
  :hook ((prog-mode text-mode) . company-mode)     
  :bind  ("<tab>"  . company-indent-or-complete-common)
  :config                                          
  (setq company-idle-delay 0)                      
  (setq company-minimum-prefix-length 1)           
  (setq company-selection-wrap-around t)           
  )                                                

This fixes it - remapping <tab> into company’s local map.

(use-package company                               
  :hook ((prog-mode text-mode) . company-mode)     
  :bind                                            
    (:map company-active-map                       
    ("<tab>"  . company-indent-or-complete-common))
  :config                                          
  (setq company-idle-delay 0)                      
  (setq company-minimum-prefix-length 1)           
  (setq company-selection-wrap-around t)           
  )                                                

Before I refactored to use-package I was doing this:

(require 'company)
    (add-hook 'after-init-hook 'global-company-mode)
    (global-set-key (kbd "<tab>") #'company-indent-or-complete-common)
    (with-eval-after-load 'company
        (define-key company-active-map (kbd "M-/") #'company-complete))

Which I believe is doing more or less the same thing.
I’m not totally clear why this results in a difference between GUI/Terminal but it was the only things that I commented out that made a difference.