m-parashar/emax64

[Question] how could i automatically load another theme?

poulpoulsen opened this issue · 6 comments

hello,
i just try to change the theme. Want my solarized-light theme back.
But after install the theme and changed the line (load-theme 'zenburn nil) inside emax.org i cannot change the theme automatically. Every start emax loads zenburn again.
Is it possible to change between available themes ?

Regards
Poul

Hi there,

You need to change the following section of emax.org and replace it with code for your theme of choice:

(use-package zenburn-theme
  :demand t
  :config
  (load-theme 'zenburn t)
  (set-face-attribute 'font-lock-comment-face nil :italic t)
  (set-face-attribute 'font-lock-doc-face nil :italic t)
  (zenburn-with-color-variables
    (set-face-attribute 'button nil :foreground zenburn-yellow-2)
    (set-face-attribute 'default nil
                        :background zenburn-bg-05
                        :height mp/font-size-default
                        :font mp/font-family)
    (set-face-attribute 'help-argument-name nil :foreground zenburn-orange :italic nil)
    (set-face-attribute 'hl-line nil :background zenburn-bg+1)
    (set-face-attribute 'header-line nil
                        :background zenburn-bg-1
                        :box `(:line-width 2 :color ,zenburn-bg-1)
                        :height mp/font-size-header-line)
    (set-face-attribute 'mode-line nil
                        :box `(:line-width 2 :color ,zenburn-bg-1)
                        :foreground zenburn-bg+3
                        :height mp/font-size-mode-line)
    (set-face-attribute 'mode-line-inactive nil
                        :box `(:line-width 2 :color ,zenburn-bg-05)
                        :foreground zenburn-bg+3
                        :height mp/font-size-mode-line)
    (set-face-attribute 'region nil
                        :background zenburn-fg-1
                        :distant-foreground 'unspecified)
    (set-face-attribute 'vertical-border nil :foreground zenburn-bg))

  ;; NOTE: See https://github.com/bbatsov/zenburn-emacs/issues/278.
  (zenburn-with-color-variables
    (mapc
     (lambda (face)
       (when (eq (face-attribute face :background) zenburn-bg)
         (set-face-attribute face nil :background 'unspecified)))
     (face-list))))

hello,
relating to m-x customize-group:
As far as i remember, emacs on windows sometimes has problems to identify ~ as HOME and / as .
E.g to go to ~/org/ as on linux.
But i d not remember how to find out if it is occur.
I activate ido-mode to test. The documentation said, that tab shows completions, but if i press tab ,cursor jumps into read-only area and a warning message occurs.

Regards
Poul

Hello,
here are my .emacs file and the generated emax.org/el files
;;; .emacs --- bootstrap the rest of it

;; Copyright (C) 2018 Manish Parashar

;; Author: Manish Parashar

;; This program is free software. You can redistribute it and/or modify it under
;; the terms of the Do What The Fuck You Want To Public License, version 2 as
;; published by Sam Hocevar.
;;
;; This program is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
;; FOR A PARTICULAR PURPOSE.
;;
;; You should have received a copy of the Do What The Fuck You Want To Public
;; License along with this program. If not, see http://www.wtfpl.net/.

;;; Commentary:

;; Following lines load an Org file and build the configuration code out of it.

;;; Code:

;;(let ((gc-cons-threshold most-positive-fixnum))

;; Set repositories
(require 'package)
(setq-default
load-prefer-newer t
package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(setq package-user-dir "~/emax/elpa")
(package-initialize)

;; Install dependencies
(unless (and (package-installed-p 'delight)
(package-installed-p 'use-package))
(package-refresh-contents)
(package-install 'delight t)
(package-install 'use-package t))
(setq-default
use-package-always-defer t
use-package-always-ensure t)

;; Use latest Org
(use-package org
;;:pin org
:ensure org-plus-contrib)

(defvar emax-root (concat (expand-file-name "~") "/emax"))
(defvar emax-bin (concat emax-root "/bin"))
(defvar emax-bin64 (concat emax-root "/bin64"))
(defvar emax-mingw64 (concat emax-root "/mingw64/bin"))
(defvar emax-lisp (concat emax-root "/lisp"))

(setq exec-path (cons emax-bin exec-path))
(setenv "PATH" (concat emax-bin ";" (getenv "PATH")))

(setq exec-path (cons emax-bin64 exec-path))
(setenv "PATH" (concat emax-bin64 ";" (getenv "PATH")))

(setq exec-path (cons emax-mingw64 exec-path))
(setenv "PATH" (concat emax-mingw64 ";" (getenv "PATH")))

(dolist (dir '("/emax/" "/emax/bin/" "/emax/bin64/" "/emax/mingw64/bin/" "/emax/lisp/" "/emax/elpa/"))
(add-to-list 'load-path dir))

(set-language-environment 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; Tangle configuration
(org-babel-load-file (expand-file-name "~/emax/emax.org" user-emacs-directory))
;;(garbage-collect))

;;; init.el ends here

Here my emax.org
#+TITLE: emaxorg
#+AUTHOR: Manish Parashar

  • Table of Content :TOC:
  • [[#bootstrap][Bootstrap]]
    • [[#use-better-defaults][Use better defaults]]
    • [[#load-customel][Load =.custom.el=]]
    • [[#load-secretel][Load =.secret.el=]]
  • [[#theme][Theme]]
  • [[#personal][Personal]]
  • Bootstrap

** Use better defaults

Maximize by default, fullscreen on Windows.

#+BEGIN_SRC emacs-lisp
;;(set-frame-parameter nil 'fullscreen (if (eq system-type 'windows-nt)
;; 'fullboth 'maximized))
;; Start fullscreen (cross-platf)
;;(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

;;(toggle-frame-maximized)
;; Start maximised (cross-platf)
(add-hook 'window-setup-hook 'toggle-frame-maximized t)
#+END_SRC

Some UI elements are rather invasive. No-mouse master race.

#+BEGIN_SRC emacs-lisp
(when window-system
;(blink-cursor-mode 0) ; Disable the cursor blinking
(scroll-bar-mode 0) ; Disable the scroll bar
(tool-bar-mode 0) ; Disable the tool bar
(tooltip-mode 0)) ; Disable the tooltips
#+END_SRC

Here are what I consider better defaults as per my own experience.

#+BEGIN_SRC emacs-lisp
(setq-default
ad-redefinition-action 'accept ; Silence warnings for redefinition
confirm-kill-emacs 'yes-or-no-p ; Confirm before exiting Emacs
cursor-in-non-selected-windows t ; Hide the cursor in inactive windows
delete-by-moving-to-trash t ; Delete files to trash
display-time-default-load-average nil ; Don't display load average
display-time-format "%H:%M" ; Format the time string
fill-column 80 ; Set width for automatic line breaks
help-window-select t ; Focus new help windows when opened
indent-tabs-mode nil ; Stop using tabs to indent
inhibit-startup-screen t ; Disable start-up screen
initial-scratch-message "" ; Empty the initial scratch buffer
left-margin-width 1 right-margin-width 1 ; Add left and right margins
mode-require-final-newline 'visit ; Add a newline at EOF on visit
mouse-yank-at-point t ; Yank at point rather than pointer
ns-use-srgb-colorspace nil ; Don't use sRGB colors
recenter-positions '(5 top bottom) ; Set re-centering positions
redisplay-dont-pause t ; don't pause display on input
debug-on-error t
jit-lock-defer-time 0
frame-resize-pixelwise t
fast-but-imprecise-scrolling t
scroll-conservatively 10000 ; Always scroll by one line
scroll-margin 1 ; scroll N lines to screen edge
scroll-step 1 ; keyboard scroll one line at a time
scroll-preserve-screen-position 1
select-enable-clipboard t ; Merge system's and Emacs' clipboard
sentence-end-double-space nil ; End a sentence after a dot and a space
show-trailing-whitespace nil ; Display trailing whitespaces
split-height-threshold nil ; Disable vertical window splitting
split-width-threshold nil ; Disable horizontal window splitting
tab-width 4 ; Set width for tabs
uniquify-buffer-name-style 'forward ; Uniquify buffer names
window-combination-resize t ; Resize windows proportionally
x-stretch-cursor t) ; Stretch cursor to the glyph width
(delete-selection-mode) ; Replace region when inserting text
(setq line-number-mode t) ; Enable line numbers in the mode-line
(setq column-number-mode t) ; Enable column numbers in the mode-line
(size-indication-mode 1) ; Enable size status in the mode-line
(display-time-mode) ; Enable time in the mode-line
(fringe-mode 0) ; Hide fringes
(fset 'yes-or-no-p 'y-or-n-p) ; Replace yes/no prompts with y/n
(global-hl-line-mode) ; Hightlight current line
(show-paren-mode t)
(setq show-paren-style 'expression)
(global-subword-mode) ; Iterate through CamelCase words
;(menu-bar-mode 0) ; Disable the menu bar
;(mouse-avoidance-mode 'banish) ; Avoid collision of mouse with point
(put 'downcase-region 'disabled nil) ; Enable downcase-region
(put 'upcase-region 'disabled nil) ; Enable upcase-region

(defvar mp/font-family "Source Code Pro" "The font to use.")
(defvar mp/font-size-default 120 "The font size to use for default text.")
(defvar mp/font-size-header-line 100 "The font size to use for the header-line.")
(defvar mp/font-size-mode-line 100 "The font size to use for the mode-line.")
(defvar mp/font-size-title 100 "The font size to use for titles.")

#+END_SRC

Garbage-collect on focus-out, Emacs /should/ feel snappier.

#+BEGIN_SRC emacs-lisp
(add-hook 'focus-out-hook #'garbage-collect)
#+END_SRC

** Load =custom.el=

One is able to use the customization interface that is bundled within Emacs. It
is meant to help people who are not familiar with Emacs Lisp in the
configuration of Emacs itself. By default, changes in the customization will be
automatically detected and appended at the end of the configuration file,
=init.el=.

Since that in my case, the actual configuration file is a new one, crafted by
=org-mode=, adding code at the end of =init.el= might mess things up. The
following tells Emacs to add extra code in another file that would be then
loaded, if existing.

#+BEGIN_SRC emacs-lisp
(setq-default custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
#+END_SRC

** Load =secret.el=

I load =~/emax/secret.el= to keep sensible things out of version control.
For instance, you could set your identity by customizing both =user-full-name=
and =user-mail-address=. This is also where you want your API tokens to live.

#+BEGIN_SRC emacs-lisp

(let ((secret.el (expand-file-name "secret.el" "~/emax/")))
(when (file-exists-p secret.el)
(load secret.el)))
#+END_SRC

  • Theme

#+BEGIN_SRC emacs-lisp
(load-theme 'solarized-light t)
;;(load-theme 'sanityinc-tomorrow-blue t)
(set-face-attribute 'default nil
:family "Source Code Pro" :height 120)
#+END_SRC

#+BEGIN_SRC emacs-lisp
(use-package mdi
:ensure nil
:load-path "~/emax/lisp/mdi/"
:after zenburn-theme)
#+END_SRC

  • Personal

** Built in keybindings
Key bindings not related to external packages or functions.

#+begin_src emacs-lisp
(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "RET") 'newline-and-indent)
#+end_src

** Newline
Add newline to end of files.
#+begin_src emacs-lisp
(setq require-final-newline t)
#+end_src

** Recentf
Number of items to be saved in recent file list.
#+begin_src emacs-lisp
(recentf-mode 1) ; keep a list of recently opened files
(setq recentf-max-saved-items 2048)
#+end_src
** Org-Mode
#+begin_src emacs-lisp
(setq org-completion-use-ido t)
#+end_src
** Smex
#+begin_src emacs-lisp
;;(require 'smex) ; Not needed if you use package.el
;;(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
; when Smex is auto-initialized on its first run.
;;(global-set-key (kbd "M-x") 'smex)
;;(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
;;(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
#+end_src
** Ido-mode
#+begin_src emacs-lisp
;;(require 'ido)
;;(ido-mode 1)
#+end_src
** Ido-completion-read
Aktuell nicht aktiviert.

** Ivy
#+begin_src emacs-lisp
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "%d/%d ")
(setq enable-recursive-minibuffers t)
(setq ivy-use-selectable-prompt t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(ivy-set-actions
'counsel-find-file
'(("d" delete-file "delete")))
#+end_src
** Counsel
#+begin_src emacs-lisp
(require 'ivy)
(counsel-mode 1)
#+end_src
** Whitespace
Delete trailing whitespaces on save.

#+begin_src emacs-lisp
(add-hook 'before-save-hook 'delete-trailing-whitespace)
#+end_src

** Hyperlinks
Open hyperlinks at point. =C-c B(rowse)=.

#+begin_src emacs-lisp
(setq browse-url-browser-function 'browse-url-default-browser)
(defun choose-browser (url &rest args)
(interactive "sURL: ")
(if (y-or-n-p "Use external browser? ")
(browse-url-default-browser url)
(w3m-browse-url url)))
(setq browse-url-browser-function 'choose-browser)
#+end_src

** Treemacs
#+begin_src emacs-lisp
(require 'treemacs)
(global-set-key (kbd "") #'treemacs-toggle)
(setq treemacs-change-root-without-asking t)
#+end_src
** Dired
#+begin_src emacs-lisp
;; dired einstellungen
(defun my/dired-mode-hook ()
(toggle-truncate-lines 1))
#+end_src
** Paced
#+begin_src emacs-lisp
;; paced-mode
(add-to-list 'load-path "C:/Users/Held/.emacs.d/lisp/paced/trunk")
(require 'paced)
;; Activate paced
(global-paced-mode)
;; Load paced dictionaries
(paced-load-all-dictionaries)
;; Save paced dictionaries after repopulating them
(setq paced-repopulate-saves-dictionary t)
;; Load async paced settings
(load "paced-async.el")
;; Enable Default dictionary in Org, markdown, and text modes
(setq paced-global-dictionary-enable-alist '((my-paced-files-check-p . "Default")))
(setq paced-throw-error-on-no-current nil)
;; Repopulate the current dictionary after saving
(add-hook 'after-save-hook 'paced-repopulate-current-dictionary-async)
(define-advice ispell-pdict-save (:after (&optional _no-query _force-save) paced-populate)
;; Repopulate the current dictionary after running spell check
(paced-repopulate-current-dictionary-async))
#+end_src
** Undo-tree
#+begin_src emacs-lisp
(global-undo-tree-mode)
undo-tree-visualizer-diff
undo-tree-visualizer-timestamps
#+end_src

  • Programming
    ** Lisp
    *** SLIME
    Setup slime with SBCL/CCL.

#+begin_src emacs-lisp

;;; Slime
(require 'slime)
(setq slime-lisp-implementations
'((ccl ("c:/ccl/wx86cl64.exe"))
;; (ecl ("c:/ecl/ecl.exe"))
(sbcl ("c:/sbcl/sbcl.exe" "-core" "c:/sbcl/sbcl.core"))))
(setq slime-default-lisp 'sbcl)

(slime-setup '(slime-fancy))
#+end_src

*** HyperSpec
Load hyperspec.

#+begin_src emacs-lisp
(eval-after-load "hyperspec"
'(progn
(setq common-lisp-hyperspec-root (concat "file:///" emax-root "/docs/HyperSpec/"))))

(eval-after-load 'slime
`(define-key slime-prefix-map (kbd "M-h") 'slime-documentation-lookup))
#+end_src

*** Paredit
Setup paredit minor mode.

#+begin_src emacs-lisp
(use-package paredit
:ensure t
:init
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'clojure-mode-hook #'enable-paredit-mode))
#+end_src

** PowerShell
Setup PowerShell on Windows.

#+begin_src emacs-lisp
;; Running Windows Powershell from within Emacs
; (setq explicit-shell-file-name "c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe")
; (setq explicit-powershell.exe-args '("-Command" "-" )) ; interactive, but no command prompt

; (autoload 'powershell "powershell" "Run powershell as a shell within emacs." t)
#+end_src

** C/C++
*** Compile key
Change compile key binding to =C-c C-c=.

#+begin_src emacs-lisp
(add-hook 'c-mode-common-hook
'(lambda ()
(local-set-key "\C-c\C-c" 'compile)))
#+end_src

*** Default indentation
Set default indentation to 4.

#+begin_src emacs-lisp
(defun my-c-mode-common-hook ()
(c-set-offset 'substatement-open 0)
;;(setq c++-tab-always-indent nil)
(setq c-basic-offset 4)
(setq c-indent-level 4)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
(setq tab-width 4))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
#+end_src

** Find init
Finds the init file and opens it.

#+begin_src emacs-lisp
(defun find-init-file ()
"Edit my init file in another window."
(interactive)
(let ((mwf-init-file "~/emax/emax.org"))
(find-file mwf-init-file)))

(bind-key "C-c I" 'find-init-file)
#+end_src

** Aspell
Setup aspell.

#+begin_src emacs-lisp
;; Changes made for Aspell
(setq-default ispell-program-name "~/emax/mingw64/bin/aspell.exe")
(setq-default ispell-extra-args '("--sug-mode=ultra"))
(setq ispell-dictionary "de_DE")

;; Set "DICTDIR" variable
(setenv "DICTDIR" (concat emax-mingw64 "/lib/aspell-0.60/"))

;; Automatically enable flyspell-mode in text-mode
;;(require 'flyspell)
;;(add-hook 'text-mode-hook 'flyspell-mode)
(setq text-mode-hook '(lambda() (flyspell-mode t) ))
;;(setq text-mode-hook '(lambda()
;; (flyspell-mode t)))

;;(dolist (hook '(text-mode-hook))
;; (add-hook hook (lambda () (flyspell-mode 1))))
;;(dolist (hook '(change-log-mode-hook log-edit-mode-hook))
;; (add-hook hook (lambda () (flyspell-mode -1))))

;;(setq flyspell-issue-message-flag nil)

;;(require 'auto-dictionary)
;;(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1)))

(require 'ispell)
#+end_src

** GnuPG
Setup GnuPG.

#+begin_src emacs-lisp
(setq epg-gpg-home-directory "/emax/mingw64/bin/")
(setq epg-gpg-program "
/emax/mingw64/bin/gpg.exe")
(setq epg-gpgconf-program "~/emax/mingw64/bin/gpgconf.exe")
#+end_src

** PDF-TOOLS
Setup PDF-TOOLS.

#+begin_src emacs-lisp
(pdf-tools-install :no-query)
#+end_src


[[#emaxorg][Back to top]]

Here my emax.el
;;(set-frame-parameter nil 'fullscreen (if (eq system-type 'windows-nt)
;; 'fullboth 'maximized))
;; Start fullscreen (cross-platf)
;;(add-hook 'window-setup-hook 'toggle-frame-fullscreen t)

;;(toggle-frame-maximized)
;; Start maximised (cross-platf)
(add-hook 'window-setup-hook 'toggle-frame-maximized t)

(when window-system
;(blink-cursor-mode 0) ; Disable the cursor blinking
(scroll-bar-mode 0) ; Disable the scroll bar
(tool-bar-mode 0) ; Disable the tool bar
(tooltip-mode 0)) ; Disable the tooltips

(setq-default
ad-redefinition-action 'accept ; Silence warnings for redefinition
confirm-kill-emacs 'yes-or-no-p ; Confirm before exiting Emacs
cursor-in-non-selected-windows t ; Hide the cursor in inactive windows
delete-by-moving-to-trash t ; Delete files to trash
display-time-default-load-average nil ; Don't display load average
display-time-format "%H:%M" ; Format the time string
fill-column 80 ; Set width for automatic line breaks
help-window-select t ; Focus new help windows when opened
indent-tabs-mode nil ; Stop using tabs to indent
inhibit-startup-screen t ; Disable start-up screen
initial-scratch-message "" ; Empty the initial scratch buffer
left-margin-width 1 right-margin-width 1 ; Add left and right margins
mode-require-final-newline 'visit ; Add a newline at EOF on visit
mouse-yank-at-point t ; Yank at point rather than pointer
ns-use-srgb-colorspace nil ; Don't use sRGB colors
recenter-positions '(5 top bottom) ; Set re-centering positions
redisplay-dont-pause t ; don't pause display on input
debug-on-error t
jit-lock-defer-time 0
frame-resize-pixelwise t
fast-but-imprecise-scrolling t
scroll-conservatively 10000 ; Always scroll by one line
scroll-margin 1 ; scroll N lines to screen edge
scroll-step 1 ; keyboard scroll one line at a time
scroll-preserve-screen-position 1
select-enable-clipboard t ; Merge system's and Emacs' clipboard
sentence-end-double-space nil ; End a sentence after a dot and a space
show-trailing-whitespace nil ; Display trailing whitespaces
split-height-threshold nil ; Disable vertical window splitting
split-width-threshold nil ; Disable horizontal window splitting
tab-width 4 ; Set width for tabs
uniquify-buffer-name-style 'forward ; Uniquify buffer names
window-combination-resize t ; Resize windows proportionally
x-stretch-cursor t) ; Stretch cursor to the glyph width
(delete-selection-mode) ; Replace region when inserting text
(setq line-number-mode t) ; Enable line numbers in the mode-line
(setq column-number-mode t) ; Enable column numbers in the mode-line
(size-indication-mode 1) ; Enable size status in the mode-line
(display-time-mode) ; Enable time in the mode-line
(fringe-mode 0) ; Hide fringes
(fset 'yes-or-no-p 'y-or-n-p) ; Replace yes/no prompts with y/n
(global-hl-line-mode) ; Hightlight current line
(show-paren-mode t)
(setq show-paren-style 'expression)
(global-subword-mode) ; Iterate through CamelCase words
;(menu-bar-mode 0) ; Disable the menu bar
;(mouse-avoidance-mode 'banish) ; Avoid collision of mouse with point
(put 'downcase-region 'disabled nil) ; Enable downcase-region
(put 'upcase-region 'disabled nil) ; Enable upcase-region

(defvar mp/font-family "Source Code Pro" "The font to use.")
(defvar mp/font-size-default 120 "The font size to use for default text.")
(defvar mp/font-size-header-line 100 "The font size to use for the header-line.")
(defvar mp/font-size-mode-line 100 "The font size to use for the mode-line.")
(defvar mp/font-size-title 100 "The font size to use for titles.")

(add-hook 'focus-out-hook #'garbage-collect)

(setq-default custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))

(let ((secret.el (expand-file-name "secret.el" "~/emax/")))
(when (file-exists-p secret.el)
(load secret.el)))

(load-theme 'solarized-light t)
;;(load-theme 'sanityinc-tomorrow-blue t)
(set-face-attribute 'default nil
:family "Source Code Pro" :height 120)

(use-package mdi
:ensure nil
:load-path "~/emax/lisp/mdi/"
:after zenburn-theme)

(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "RET") 'newline-and-indent)

(setq require-final-newline t)

(recentf-mode 1) ; keep a list of recently opened files
(setq recentf-max-saved-items 2048)

(setq org-completion-use-ido t)

;;(require 'smex) ; Not needed if you use package.el
;;(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
; when Smex is auto-initialized on its first run.
;;(global-set-key (kbd "M-x") 'smex)
;;(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
;;(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

;;(require 'ido)
;;(ido-mode 1)

(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "%d/%d ")
(setq enable-recursive-minibuffers t)
(setq ivy-use-selectable-prompt t)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(ivy-set-actions
'counsel-find-file
'(("d" delete-file "delete")))

(require 'ivy)
(counsel-mode 1)

(add-hook 'before-save-hook 'delete-trailing-whitespace)

(setq browse-url-browser-function 'browse-url-default-browser)
(defun choose-browser (url &rest args)
(interactive "sURL: ")
(if (y-or-n-p "Use external browser? ")
(browse-url-default-browser url)
(w3m-browse-url url)))
(setq browse-url-browser-function 'choose-browser)

(require 'treemacs)
(global-set-key (kbd "") #'treemacs-toggle)
(setq treemacs-change-root-without-asking t)

;; dired einstellungen
(defun my/dired-mode-hook ()
(toggle-truncate-lines 1))

;; paced-mode
(add-to-list 'load-path "C:/Users/Held/.emacs.d/lisp/paced/trunk")
(require 'paced)
;; Activate paced
(global-paced-mode)
;; Load paced dictionaries
(paced-load-all-dictionaries)
;; Save paced dictionaries after repopulating them
(setq paced-repopulate-saves-dictionary t)
;; Load async paced settings
(load "paced-async.el")
;; Enable Default dictionary in Org, markdown, and text modes
(setq paced-global-dictionary-enable-alist '((my-paced-files-check-p . "Default")))
(setq paced-throw-error-on-no-current nil)
;; Repopulate the current dictionary after saving
(add-hook 'after-save-hook 'paced-repopulate-current-dictionary-async)
(define-advice ispell-pdict-save (:after (&optional _no-query _force-save) paced-populate)
;; Repopulate the current dictionary after running spell check
(paced-repopulate-current-dictionary-async))

(global-undo-tree-mode)
undo-tree-visualizer-diff
undo-tree-visualizer-timestamps

;;; Slime
(require 'slime)
(setq slime-lisp-implementations
'((ccl ("c:/ccl/wx86cl64.exe"))
;; (ecl ("c:/ecl/ecl.exe"))
(sbcl ("c:/sbcl/sbcl.exe" "-core" "c:/sbcl/sbcl.core"))))
(setq slime-default-lisp 'sbcl)

(slime-setup '(slime-fancy))

(eval-after-load "hyperspec"
'(progn
(setq common-lisp-hyperspec-root (concat "file:///" emax-root "/docs/HyperSpec/"))))

(eval-after-load 'slime
`(define-key slime-prefix-map (kbd "M-h") 'slime-documentation-lookup))

(use-package paredit
:ensure t
:init
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(add-hook 'clojure-mode-hook #'enable-paredit-mode))

;; Running Windows Powershell from within Emacs
; (setq explicit-shell-file-name "c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe")
; (setq explicit-powershell.exe-args '("-Command" "-" )) ; interactive, but no command prompt

; (autoload 'powershell "powershell" "Run powershell as a shell within emacs." t)

(add-hook 'c-mode-common-hook
'(lambda ()
(local-set-key "\C-c\C-c" 'compile)))

(defun my-c-mode-common-hook ()
(c-set-offset 'substatement-open 0)
;;(setq c++-tab-always-indent nil)
(setq c-basic-offset 4)
(setq c-indent-level 4)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
(setq tab-width 4))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

(defun find-init-file ()
"Edit my init file in another window."
(interactive)
(let ((mwf-init-file "~/emax/emax.org"))
(find-file mwf-init-file)))

(bind-key "C-c I" 'find-init-file)

;; Changes made for Aspell
(setq-default ispell-program-name "~/emax/mingw64/bin/aspell.exe")
(setq-default ispell-extra-args '("--sug-mode=ultra"))
(setq ispell-dictionary "de_DE")

;; Set "DICTDIR" variable
(setenv "DICTDIR" (concat emax-mingw64 "/lib/aspell-0.60/"))

;; Automatically enable flyspell-mode in text-mode
;;(require 'flyspell)
;;(add-hook 'text-mode-hook 'flyspell-mode)
(setq text-mode-hook '(lambda() (flyspell-mode t) ))
;;(setq text-mode-hook '(lambda()
;; (flyspell-mode t)))

;;(dolist (hook '(text-mode-hook))
;; (add-hook hook (lambda () (flyspell-mode 1))))
;;(dolist (hook '(change-log-mode-hook log-edit-mode-hook))
;; (add-hook hook (lambda () (flyspell-mode -1))))

;;(setq flyspell-issue-message-flag nil)

;;(require 'auto-dictionary)
;;(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1)))

(require 'ispell)

(setq epg-gpg-home-directory "/emax/mingw64/bin/")
(setq epg-gpg-program "
/emax/mingw64/bin/gpg.exe")
(setq epg-gpgconf-program "~/emax/mingw64/bin/gpgconf.exe")

(pdf-tools-install :no-query)

Hope it helps
Regards
Poul

(getenv "HOME") will return the ~ path emacs uses on your system.

As for the rest of it, well, this is merely a barebones setup. You can start from scratch or even use your old config with minor changes. I'll look into it when I have some time on my hands. Thanks for understanding.

hello,
i installed a barebone version of emacs and tried again. No luck.
So the problem might be anywhere else, but not here.
Close it.
Thanks for support.
Regards
Poul