From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Hadrien Lacour Newsgroups: gmane.emacs.help Subject: emacsclient question: tty-setup-hook and X specific config Date: Thu, 22 Nov 2018 23:00:50 +0100 Message-ID: <20181122220050.nj75ntfw245x5zu5@gentoo-zen2700x> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qhanboilstref7sd" X-Trace: blaine.gmane.org 1542925888 27815 195.159.176.226 (22 Nov 2018 22:31:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Nov 2018 22:31:28 +0000 (UTC) User-Agent: NeoMutt/20180716 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 22 23:31:24 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gPxVK-000766-2Y for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Nov 2018 23:31:22 +0100 Original-Received: from localhost ([::1]:49555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPxXQ-0005a5-NZ for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Nov 2018 17:33:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPx21-0004To-LD for help-gnu-emacs@gnu.org; Thu, 22 Nov 2018 17:01:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPx1y-0003iJ-AF for help-gnu-emacs@gnu.org; Thu, 22 Nov 2018 17:01:05 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:39470) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gPx1x-0003bz-Sn for help-gnu-emacs@gnu.org; Thu, 22 Nov 2018 17:01:02 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 7376F160065 for ; Thu, 22 Nov 2018 23:00:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1542924055; bh=3GZikrpGSLXFBv8XmUlc1SvvsZV27xH64tABxUVWsag=; h=Date:From:To:Subject:From; b=SV+nmOQzq/LblYxWNlNQNsTBgsBsNWzKXbAH5oPMekjfk651kim0AmLZD0r+G1UGz OeRzrsaSSjSLM/hSCBtV/a6rWEQenEOIP586aV9UP5DFczpYAVqcWa4wOd0UWK1nr1 R8NXZXlMRQl3C4Swa4zDD5ISQ9XEW8CF+gBCaizpAQD8pASxdDT0610luT2AEEe5dY Qm9A0b/cPBAOpCvAiNDkAQEpoOgZaCqjsxIL5rKvPHzMvc6baE/U1Ehlp0cGUg6gm/ L/I5GFptHO6DyVhODFepoIJPX/KBEDVR/OxDyzlYUpqULMb3Js1poTA5hveCPzvRbb joIdP7yhSgjkA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 431D0P63pKz6tmN for ; Thu, 22 Nov 2018 23:00:53 +0100 (CET) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.67.36.65 X-Mailman-Approved-At: Thu, 22 Nov 2018 17:30:53 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118731 Archived-At: --qhanboilstref7sd Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hello, I'm trying to convert my current .emacs config to work with emacs --daemon/emacsclient. So far I've encountered two problems: * The tty-hook-setup hook is run as it should (on `emacs -nw` and `emacsclient -nw` invocations) but doesn't load my terminal specific file after the first `emacsclient -nw` call. $ emacs -nw myfile $ emacs --daemon $ emacsclient -nw -c myfile $ emacsclient -nw -c myfile The last line doesn't load st.el (attached). * I want to apply theming only for graphical frames, but If I do: $ emacs --daemon $ emacsclient -nw -c myfile $ emacsclient -c myfile $ emacsclient -nw -c myfile The theme is applied for the last two lines, even when using the -c option each time. The first one looks like a bug to me, and the second is just me not knowing how to do that. Attached are my config file (~/.emacs) and my terminal file (~/.emacs.d/lisp/term/st.el). Any idea about the why and how to fix it? Regards, Hadrien Lacour --qhanboilstref7sd Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=".emacs" (add-to-list 'load-path "~/.emacs.d/lisp/") (defun x-config () ;; Theming (message "Applying X config") (custom-set-variables '(ansi-color-faces-vector [default default default italic underline success warning error]) '(ansi-color-names-vector ["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"]) '(custom-enabled-themes (quote (deeper-blue))) '(package-selected-packages (quote (company eglot auctex)))) (custom-set-faces '(default ((t (:inherit nil :stipple nil :background "#181a26" :foreground "gray80" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "1ASC" :family "xos4 Terminus"))))) (setq-default cursor-type '(bar . 1)) ;; Packages (require 'package) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (package-initialize) ;; Completion (require 'company) (add-hook 'prog-mode-hook 'company-mode) (setq company-minimum-prefix-length 3 company-idle-delay 0 company-tooltip-limit 10 company-dabbrev-downcase nil) ;; Eglot (require 'eglot) (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")) (add-hook 'c-mode-hook 'eglot-ensure) ;; Various prog-mode stuff (add-hook 'prog-mode-hook 'electric-pair-mode) (add-hook 'prog-mode-hook 'linum-mode)) (defun apply-x-config (&optional frame) (if (display-graphic-p frame) (x-config))) ;; Apply config when creating a frame or launching emacs (add-hook 'after-make-frame-functions 'apply-x-config) (add-hook 'tty-setup-hook (lambda () (message "tty-setuphook run"))) (apply-x-config) ;; Misc display (setq-default indent-tabs-mode t) (setq-default tab-width 4) (set-default 'truncate-lines t) (add-hook 'prog-mode-hook (show-paren-mode 1)) ;; c-mode (setq c-default-style "bsd" c-basic-offset 4) (c-set-offset 'case-label '+) (c-set-offset 'arglist-cont-nonempty '+) (c-set-offset 'statement-cont '+) ;; sh-mode (setq sh-indent-after-continuation 'always) ;; elisp-mode (put 'if 'lisp-indent-function nil) ;; diff-mode (defun custom-diff-colors () (set-face-foreground 'diff-added "green") (set-face-background 'diff-added "unspecified") (set-face-foreground 'diff-removed "red") (set-face-background 'diff-removed "unspecified") (set-face-background 'diff-file-header "unspecified")) (eval-after-load "diff-mode" '(custom-diff-colors)) ;; Latex (add-hook 'LaTeX-mode-hook 'auto-fill-mode) (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) (add-hook 'LaTeX-mode-hook 'turn-on-reftex) (setq reftex-plug-into-AUCTeX t) (setq-default TeX-master nil) (setq TeX-auto-save t) (setq TeX-parse-self t) ;; Vapoursynth (add-to-list 'auto-mode-alist '("\\.vpy\\'" . python-mode)) ;; Spellcheck (setq ispell-dictionary "fr_FR") ;; Ruler (require 'whitespace) (setq whitespace-line-column 79) (setq whitespace-style '(face lines-tail)) (global-whitespace-mode 1) ;; Misc bindings (defun sed-on-region (b e script) "Run a sed script on a region" (interactive "r\nsSed script on region: ") (call-process-region b e "sed" t t t "-E" "--" script)) (global-set-key (kbd "C-c C-e") 'sed-on-region) (defun comment-region-binding () (local-set-key (kbd "C-c C-u") 'uncomment-region) (local-set-key (kbd "C-c C-c") 'comment-region)) (add-hook 'prog-mode-hook 'comment-region-binding) (add-hook 'LaTeX-mode-hook 'comment-region-binding) (setq smerge-command-prefix "\C-cm") (add-hook 'prog-mode-hook (lambda() (local-set-key (kbd "C-c ") 'hs-show-block) (local-set-key (kbd "C-c ") 'hs-hide-block) (local-set-key (kbd "C-c ") 'hs-hide-all) (local-set-key (kbd "C-c ") 'hs-show-all) (hs-minor-mode t))) ;; Misc (add-hook 'before-save-hook 'delete-trailing-whitespace) (setq inhibit-startup-screen t) (setq auto-save-default nil) (setq backup-inhibited t) (scroll-bar-mode -1) (tool-bar-mode -1) (menu-bar-mode -1) (setq-default fill-column 79) (setq frame-resize-pixelwise t) (savehist-mode t) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) --qhanboilstref7sd Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="st.el" Content-Transfer-Encoding: quoted-printable (message "Registering st keybinds") (define-key input-decode-map "=1B[1;5A" [C-up]) (define-key input-decode-map "=1B[1;5B" [C-down]) (define-key input-decode-map "=1B[1;5C" [C-right]) (define-key input-decode-map "=1B[1;5D" [C-left]) (define-key input-decode-map "=1B[1~" [home]) (define-key input-decode-map "=1B[4~" [end]) --qhanboilstref7sd--