Emacs (26.3) with ivy/counsel hangs on find-file - emacs

After setting up my emacs (26.3) with use-package and ivy/counsel, among other packages, emacs is sometimes hanging on C-x C-f. C-g does work to quit the process.
I ran debug-on-quit and this was the output:
Debugger entered--Lisp error: (quit)
ffap-file-at-point()
ffap-guesser()
ffap-guess-file-name-at-point()
run-hook-with-args-until-success(ffap-guess-file-name-at-point)
ivy-thing-at-point()
ivy--reset-state(#s(ivy-state :prompt "Find file: " :collection read-file-name-internal :predicate nil :require-match confirm-after-completion :initial-input nil :history file-name-history :preselect nil :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (96 lambda (&optional arg) "nil (`nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :update-fn nil :sort nil :frame #<frame F1 0xc90b00> :window #<window 1 on models.py> :buffer #<buffer models.py> :text nil :action (1 ("o" counsel-find-file-action "default") ("i" ivy--action-insert "insert") ("w" ivy--action-copy "copy") ("j" find-file-other-window "other window") ("f" find-file-other-frame "other frame") ("b" counsel-find-file-cd-bookmark-action "cd bookmark") ("x" counsel-find-file-extern "open externally") ("r" counsel-find-file-as-root "open as root") ("R" find-file-read-only "read only") ("l" find-file-literally "open literally") ("k" counsel-find-file-delete "delete") ("c" counsel-find-file-copy "copy file") ("m" counsel-find-file-move "move or rename") ("d" counsel-find-file-mkdir-action "mkdir")) :unwind nil :re-builder ivy--regex-plus :matcher counsel--find-file-matcher :dynamic-collection nil :display-transformer-fn ivy-read-file-transformer :directory "/home/alazar66/code/learning/html/qijc/app/" :caller counsel-find-file :current nil :def nil :ignore t :multi-action nil :extra-props nil))
ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher :initial-input nil :action counsel-find-file-action :preselect nil :require-match confirm-after-completion :history file-name-history :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (96 lambda (&optional arg) "nil (`nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :caller counsel-find-file)
counsel--find-file-1("Find file: " nil counsel-find-file-action counsel-find-file)
counsel-find-file()
funcall-interactively(counsel-find-file)
call-interactively(counsel-find-file nil nil)
command-execute(counsel-find-file)
In case it's helpful, here's some of my .emacs:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(when (not (package-installed-p 'use-package))
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(use-package projectile
:ensure t
:config
(projectile-mode))
(use-package which-key
:ensure t
:config
(which-key-mode))
(use-package transpose-frame
:ensure t)
(use-package counsel
:after ivy
:config (counsel-mode))
(use-package ivy
:defer 0.1
:diminish
:ensure t
:config (ivy-mode))
(use-package swiper
:after ivy
:bind (("C-s" . swiper)
("C-r" . swiper)))

Related

[emacs][Tuareg-mode] Symbol's function definition is void: dolist

I tried to install Tuareg-mode for Ocaml as advice on the Inria website.
Any time I try to launch it I have this error :
Symbol's function definition is void: dolist
With edebug-defun
Debugger entered--Lisp error: (void-function dolist)
apply(debug error (void-function dolist))
edebug(error (void-function dolist))
(dolist (buf (buffer-list)) (save-current-buffer (set-buffer buf) (if (derived-mode-p (quote tuareg-mode)) (progn (abbrev-mode (if val 1 -1))))))
(lambda (var val) (set-default var val) (dolist (buf (buffer-list)) (save-current-buffer (set-buffer buf) (if (derived-mode-p (quote tuareg-mode)) (progn (abbrev-mode (if val 1 -$
custom-initialize-reset(tuareg-use-abbrev-mode t)
custom-declare-variable(tuareg-use-abbrev-mode t "*Non-nil means electrically indent lines starting with leading keywords.\nLeading keywords are such as `end', `done', `else' etc$
eval-buffer(#<buffer *load*> nil "/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" nil t) ; Reading at buffer position 13589
load-with-code-conversion("/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" "/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" nil t)
command-execute(tuareg-mode record)
execute-extended-command(nil "tuareg-mode")
call-interactively(execute-extended-command nil nil)
recursive-edit()
edebug--recursive-edit(before)
edebug--display(nil 0 before)
edebug-debugger(0 before nil)
edebug-before(0)
(edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))
(lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t)))()
edebug-enter(edebug-anon0 nil (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))))
edebug-enter(edebug-anon0 nil (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))))
eval((edebug-enter (quote edebug-anon0) nil (function (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t)))$
eval-expression((edebug-enter (quote edebug-anon0) nil (function (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml$
edebug-defun()
call-interactively(edebug-defun record nil)
command-execute(edebug-defun record)
execute-extended-command(nil "edebug-defun")
call-interactively(execute-extended-command nil nil)
"/nfs/ring/users/2013/phibonacci" is my home directory.
I followed this : http://www.emacswiki.org/emacs/TuaregMode (only replaced ~/.elisp/tuareg-mode by my own path ~/.emacs.d/tuareg-mode)
emacs 24.3.1 (2013) /
tuareg 2.0.6 (2012)
dolist is from the common lisp Emacs library. If tuareg uses dolist without an (eval-when-compile ...(require 'cl)...) it's a bug. As a workaround you can do (require 'cl) in your .emacs. This is not recommended by the purist Emacs community, but it's fairly common.
IIRC dolist was added to standard Elisp sometimes around Emacs-21, so there's something really wrong with your setup.

Adding a file-exists-p condition inside an interactive list of a function

I'm having difficulty trying to add an if file-exists-p condition inside the interactive list of this print-to-pdf function. The error message is: file-name-sans-extension: Wrong type argument: stringp, t. I have commented out the section that works, but which nevertheless overwrites an existing file without prompting for a yes or no. I've tried replacing hello-world with pdf-file-name, but that didn't fix the error.
Emacs Trunk developer build --with-ns on OSX, using ns-read-file-name, likes to overwrite files without prompting unless an additional file-exists-p is included in the function.
(defun print-to-pdf (pdf-file-name)
"Print the current file to the given file."
;; (interactive (list (ns-read-file-name "Write PDF file: " "~/" nil ".pdf")
(interactive (list
(let ((hello-world (ns-read-file-name "Write PDF file: " "~/" nil ".pdf")))
(if (file-exists-p hello-world)
(or (yes-or-no-p (format "File %s exists. Save anyway? " hello-world))
(error ""))))
))
(let (
(ps-file-name (concat (file-name-sans-extension pdf-file-name) ".ps"))
(wbuf (generate-new-buffer "*Wrapped*"))
(sbuf (current-buffer)))
(jit-lock-fontify-now)
(save-current-buffer
(set-buffer wbuf)
(insert-buffer sbuf)
(longlines-mode t)
(harden-newlines)
(message (buffer-name sbuf))
(spool-buffer-given-name (buffer-name sbuf))
(kill-buffer wbuf)
(switch-to-buffer "*PostScript*")
(write-file ps-file-name)
(kill-buffer (current-buffer)))
(call-process "/usr/local/bin/ps2pdf14" nil nil nil ps-file-name pdf-file-name)
(delete-file ps-file-name)
(message "PDF saved to %s" pdf-file-name))
)
Why do you want to add it to interactive in the first place? Wouldn't something like this work for you?
(defun print-to-pdf (pdf-file-name)
"Print the current buffer to the given file as PDF."
(interactive (list (ns-read-file-name "Write PDF file: " "~/" nil ".pdf")))
(when (and pdf-file-name
(or (not (file-exists-p pdf-file-name))
(yes-or-no-p "File exists. Overwrite? ")))
(let ((ps-file-name (concat (file-name-sans-extension pdf-file-name) ".ps"))
(wbuf (generate-new-buffer "*Wrapped*"))
(sbuf (current-buffer)))
(jit-lock-fontify-now)
(save-current-buffer
(set-buffer wbuf)
(insert-buffer sbuf)
(longlines-mode t)
(harden-newlines)
(message (buffer-name sbuf))
(spool-buffer-given-name (buffer-name sbuf))
(kill-buffer wbuf)
(switch-to-buffer "*PostScript*")
(write-file ps-file-name)
(kill-buffer (current-buffer)))
(call-process "/usr/local/bin/ps2pdf14" nil nil nil ps-file-name pdf-file-name)
(delete-file ps-file-name)
(message "PDF saved to %s" pdf-file-name))))

emacs 24.x Recursive 'require' for feature 'magit-simple-keys'

I've just upgraded my whole distro and I'm trying to setup my emacs with my previous settings and when using my 'magit' plugin and typing 'M-x magit-status' I get the following error:
Recursive `require' for feature `magit-simple-keys'
Here is my config (.emacs.d/init.el)
(require 'package)
(add-to-list 'package-archives '("elpa" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)
(setq required-packages
(list 'mwe-log-commands 'drag-stuff 'flymake-ruby 'flymake-haml 'regex-tool 'mic-paren 'highline 'android-mode 'css-mode 'csv-mode 'apache-mode 'crontab-mode 'emms 'switch-window 'multi-term 'undo-tree 'rvm 'auto-complete 'yasnippet-bundle 'ruby-electric 'rinari 'inf-ruby 'coffee-mode 'yaml-mode 'feature-mode 'scss-mode 'haml-mode 'magit-simple-keys))
(dolist (package required-packages)
(when (not (package-installed-p package))
(package-refresh-contents)
(package-install package)))
;; Setup external directory variable
(setq elisp-dir
(expand-file-name "elisp" user-emacs-directory))
(setq elisp-external-dir
(expand-file-name "external" elisp-dir))
;; Add external projects to load path
(add-to-list 'load-path elisp-external-dir)
(dolist (project (directory-files elisp-external-dir t "\\w+"))
(when (file-directory-p project)
(add-to-list 'load-path project)))
; Keybinding
(global-set-key [f1] 'twit)
(global-set-key [f2] 'gist-region-or-buffer)
(global-set-key [f3] 'switch-window)
(global-set-key [f4] 'magit-display-log)
(global-set-key [f5] 'magit-status)
(global-set-key [f6] 'multi-term)
(global-set-key [f7] 'split-window-vertically)
(global-set-key [f8] 'next-multiframe-window)
;; f9 is taken by git-status somewhere.
(global-set-key [f10] 'undo-tree-visualize)
(global-set-key [f12] 'switch-full-screen)
(global-set-key (kbd "C-x f") 'rinari-find-file-in-project)
(global-set-key (kbd "C-x g") 'rinari-rgrep)
(global-set-key (kbd "C-c I") 'irc)
;fullscreen mode
(defun switch-full-screen ()
(interactive)
(shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
;; Allow using mouse thumb button to browse URLs
(global-set-key [mouse-10] 'browse-url-at-mouse)
; stop emacs from contaminating each directory with semantic.cache
(setq semanticdb-default-save-directory "/tmp")
; General settings
(setq-default tab-width 4)
(menu-bar-mode 1) ;; enable the menu bar
(tool-bar-mode -1) ; Disable tool-bar
(display-battery-mode)
(setq column-number-mode t)
(display-time)
(setq backup-inhibited t) ;; disable backup
;; Org-mode options
(add-hook 'org-mode-hook 'turn-on-visual-line-mode)
;; (add-hook 'org-mode-hook 'my-org-mode-autosave-settings)
;; (defun my-org-mode-autosave-settings ()
;; (set (make-local-variable 'auto-save-visited-file-name) t)
;; (setq auto-save-interval 20))
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(setq org-agenda-files '("~/Dropbox/org/"))
(setq org-directory "~/Dropbox/org")
(setq org-mobile-inbox-for-pull "~/Dropbox/org/inbox.org");; new notes will be stored here
(setq org-support-shift-select t)
(setq org-mobile-directory "~/Dropbox/MobileOrg") ;; Set to <your Dropbox root directory>/MobileOrg.
;; Set color
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
; Auto complete settings
(setq hippie-expand-try-functions-list
'(try-complete-abbrev
try-complete-file-name
try-expand-dabbrev))
; -------------------- Custom Settings --------------------
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
'(display-battery-mode t)
'(display-time-mode t)
'(ecb-options-version "2.32")
'(inhibit-startup-screen t)
'(org-agenda-files (quote ("~/Dropbox/org")) t)
'(rails-ws:default-server-type "mongrel")
'(send-mail-function (quote smtpmail-send-it))
'(smtpmail-smtp-server "smtp.googlemail.com")
'(smtpmail-smtp-service "smtp")
'(tool-bar-mode nil)
'(tooltip-mode nil))
; -------------------- File plugins --------------------
; Interactively Do Things
(ido-mode t)
; tramp - remote ssh editing
(require 'tramp)
(setq tramp-default-method "ssh")
; -------------------- Rails setting files --------------------
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
; -------------------- Rails minor plugin --------------------
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;; https://github.com/remvee/emacs-rails
;; Currently this interfers with auto complete, using rinari instead
;; automatically adds end to blocks.
(require 'rails)
;; Rinari - Rails plugin
(add-to-list 'load-path "~/.emacs.d/rinari/")
(require 'rinari)
(add-hook 'ruby-mode-hook
(lambda ()
(defadvice ruby-mode-set-encoding
(around ruby-mode-set-encoding-disable activate) nil)))
; -------------------- Rails Views --------------------
; haml-sass
(require 'haml-mode nil 't)
(add-hook 'haml-mode-hook
'(lambda () (setq tab-width 2)))
(setq scss-compile-at-save nil)
; stylesheets
(autoload 'css-mode "css-mode")
(setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist))
; html2haml function to convert current buffer to haml
(defun haml-ify ()
"run html2haml on current buffer"
(interactive)
(setf filename buffer-file-name)
(setf newfilename (concat filename ".haml"))
(save-buffer)
(shell-command (concat
"html2haml " filename " > " newfilename))
(kill-buffer (current-buffer))
(delete-file filename)
(find-file newfilename))
;; -------------------- Rails Testing --------------------
;; Cucumber
(require 'feature-mode)
;; -------------------- Rails Tools --------------------
;; Check out abbrev-mode instead as it seems lighter.
(require 'snippet)
;; -------------------- Ruby plugins --------------------
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-to-list 'auto-mode-alist '("god" . ruby-mode))
(add-to-list 'auto-mode-alist '("Guardfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.html.erb\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.ejs\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.eco\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.hamlc\\'" . haml-mode))
;; Ruby-electric
(require 'ruby-electric)
(add-hook 'ruby-mode-hook 'ruby-electric-mode)
;; Issues under some compiles of emacs
;; (require 'ruby-electric)
;; (add-hook 'ruby-mode-hook
;; (lambda()
;; (add-hook 'local-write-file-hooks
;; '(lambda()
;; (save-excursion
;; (untabify (point-min) (point-max))
;; ;(delete-trailing-whitespace)
;; )))
;; (set (make-local-variable 'indent-tabs-mode) 'nil)
;; (set (make-local-variable 'tab-width) 2)
;; (imenu-add-to-menubar "IMENU")
;; (require 'ruby-electric)
;; (ruby-electric-mode t)))
;; Inferior Ruby Mode
(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t)
(autoload 'inf-ruby-keys "inf-ruby" "" t)
(eval-after-load 'ruby-mode '(add-hook 'ruby-mode-hook 'inf-ruby-keys))
;; -------------------- SQL --------------------
(defun my-sql-interactive-mode-hook ()
(setq tab-width 8))
(add-hook 'sql-interactive-mode-hook 'my-sql-interactive-mode-hook)
(require 'sql)
(put 'upcase-region 'disabled nil)
;; -------------------- Autocomplete --------------------
;; Use with Rsense for Ruby autocomplete:
;; http://cx4a.org/software/rsense/
;; Follow instructions on: http://itstickers.blogspot.com/2010/11/all-about-emacs.html
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
;; Rsense
(setq rsense-home "/opt/rsense-0.3")
(add-to-list 'load-path (concat rsense-home "/etc"))
(require 'rsense)
;; Rsense + Autocomplete
(add-hook 'ruby-mode-hook
(lambda ()
(add-to-list 'ac-sources 'ac-source-rsense-method)
(add-to-list 'ac-sources 'ac-source-rsense-constant)))
;; Complete by C-c .
(add-hook 'ruby-mode-hook
(lambda ()
(local-set-key (kbd "C-c .") 'rsense-complete)))
;; RVM in emacs
;; (require 'rvm)
;; (rvm-use-default) ;; use rvm’s default ruby for the current Emacs session
;; Switch windows easier when you have 3 or more.
(require 'switch-window)
;; gist
(require 'gist)
(setq gist-authentication-function 'gist-basic-authentication)
(setq the-secrets-file
(expand-file-name "secrets.el" user-emacs-directory))
(when (file-exists-p the-secrets-file)
(load the-secrets-file))
;; highline-mode
(require 'highline)
(defun highline-mode-on ()
(highline-mode 1))
;; Turn on local highlighting for Dired (C-x d)
(add-hook 'dired-after-readin-hook #'highline-mode-on)
;; Turn on local highlighting for list-buffers (C-x C-b)
(defadvice list-buffers (after highlight-line activate) (save-excursion (set-buffer "*Buffer List*") (highline-mode-on)))
;; mic-paren - advanced highlighting of matching parentheses
(paren-activate)
;; flyspell
(add-hook 'org-mode-hook
(lambda ()
(flyspell-mode)
(setq flyspell-issue-message-flag 'nil)))
(add-hook 'ruby-mode-hook
(lambda ()
(flyspell-prog-mode)
(setq flyspell-issue-message-flag 'nil)))
;; flymake haml
(add-hook 'haml-mode-hook 'flymake-haml-load)
;; undo
(add-hook 'ruby-mode-hook 'undo-tree-mode)
;; multi-term
;; (setq term-default-fg-color "#aaa")
;; Upgrade all packages
(defun package-update-all ()
"Update all packages"
(interactive)
(dolist (elt package-alist)
(let* ((name (car elt))
(file-name (symbol-name name))
(available-pkg (assq name package-archive-contents))
(available-version (and available-pkg
(package-desc-vers (cdr available-pkg))))
(current-version (package-desc-vers (cdr elt)))
)
(when (and available-version
(version-list-< current-version available-version))
(message "Updating to: %s - %s" file-name
(package-version-join available-version))
(package-install name)
(package-delete file-name (package-version-join current-version))))))
;; Music player
(add-to-list 'load-path "~/.emacs.d/elisp/external/bongo")
(setq bongo-global-lastfm-mode t)
(autoload 'bongo "bongo"
"Start Bongo by switching to a Bongo buffer." t)
;; Volume manager (Use 'v' in bongo music player)
(add-to-list 'load-path "~/.emacs.d/elisp/external/volume-el")
(autoload 'volume "volume"
"Tweak your sound card volume." t)
;; Twitter mode
(add-to-list 'load-path "~/.emacs.d/elisp/external/twitter-mode")
(require 'twittering-mode)
(setq twittering-icon-mode t)
(setq twittering-timer-interval 40)
(setq twittering-url-show-status nil)
(add-hook 'twittering-edit-mode-hook (lambda () (ispell-minor-mode) (flyspell-mode)))
(setq twittering-use-master-password t) ;; Don't prompt for authorisation.
;; drag-stuff
(require 'drag-stuff)
;; coffee-mode
(defun coffee-custom ()
"coffee-mode-hook"
(set (make-local-variable 'tab-width) 2))
;; (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer)
;; (define-key coffee-mode-map [(meta R)] 'coffee-compile-region)
(add-hook 'coffee-mode-hook
'(lambda() (coffee-custom)))
;; Don't ask to save abbrevs
(setq save-abbrevs 'silently)
;; log commands.
;; M-x mwe:open-command-log-buffer
(add-hook 'LaTeX-mode-hook (function mwe:log-keyboard-commands))
;; screensaver
(setq zone-when-idle t)
;; IRC reconnect
(eval-after-load 'rcirc
'(defun-rcirc-command reconnect (arg)
"Reconnect the server process."
(interactive "i")
(unless process
(error "There's no process for this target"))
(let* ((server (car (process-contact process)))
(port (process-contact process :service))
(nick (rcirc-nick process))
channels query-buffers)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (eq process (rcirc-buffer-process))
(remove-hook 'change-major-mode-hook
'rcirc-change-major-mode-hook)
(if (rcirc-channel-p rcirc-target)
(setq channels (cons rcirc-target channels))
(setq query-buffers (cons buf query-buffers))))))
(delete-process process)
(rcirc-connect server port nick
rcirc-default-user-name
rcirc-default-full-name
channels))))
;; Video editor
;; (load "~/.emacs.d/elisp/external/gneve.el")
The problem was I only need to install 'magit not 'magit-simple-keys.
I am going to guess that you need to update one or other of magit and magit-simple-keys (and you might as well do both).
I can see that you are installing magit-simple-keys via package.el, but not magit itself, so you might want to source magit from there too in order to try to keep the versions synchronised.

How can I execute a lisp function while pressing prefix key C-h and then let Emacs continue the normal processing of C-h?

I want to execute a lisp function while pressing prefix key C-h and then let Emacs continue the normal processing of C-h.
How can I do it?
Thank you!
Evaluating
(key-binding [(control h)])
I found out the command bound is help-command. You can use an "around" defadvice to run your code. See manual.
(defvar smart-ime--state 'normal)
(defvar smart-ime--debug nil)
(defvar smart-ime--ena-prefix-override-keymap nil)
(defvar smart-ime--prefix-override-keymap (make-sparse-keymap))
(defvar smart-ime--keymaps-initialized nil)
(defvar smart-ime--keymap-alist
`(
(smart-ime--ena-prefix-override-keymap . ,smart-ime--prefix-override-keymap)
)
)
(defun smart-ime--init-keymaps ()
(define-key smart-ime--prefix-override-keymap [(control x)] 'smart-ime--prefix-override-handler)
(define-key smart-ime--prefix-override-keymap [(control c)] 'smart-ime--prefix-override-handler)
(define-key smart-ime--prefix-override-keymap [(control h)] 'smart-ime--prefix-override-handler)
)
(defun smart-ime--prefix-override-handler (arg)
(interactive "P")
(smart-ime--prefix-override-replay arg))
;; the most important part
(defun smart-ime--prefix-override-replay (arg)
(let* ((keys (this-command-keys))
(i (length keys))
(key (aref keys (1- i))))
(ime-save-and-set-status 0)
(add-hook 'post-command-hook 'smart-ime--post-command-handler)
(setq smart-ime--state 'prefix)
(setq smart-ime--ena-prefix-override-keymap nil)
;; Don't record this command
(setq this-command last-command)
;; Restore the prefix arg
(setq prefix-arg arg)
(reset-this-command-lengths)
;; Push the key back on the event queue
(setq unread-command-events (cons key unread-command-events))))
(defun smart-ime--post-command-handler-1 ()
(cond ((eq smart-ime--state 'prefix)
(setq smart-ime--state 'sequence))
((eq smart-ime--state 'sequence)
(ime-restore-status)
(setq smart-ime--ena-prefix-override-keymap t)
(setq smart-ime--state 'normal)
(remove-hook 'post-command-hook 'smart-ime--post-command-handler)))
(t
(error "error state")))
(defun smart-ime--post-command-handler ()
(when smart-ime-mode
(condition-case nil
(smart-ime--post-command-handler-1)
(error nil))))
(define-minor-mode smart-ime-mode
"Toggle Smart IME mode."
:init-value nil
:lighter " SmartIME"
:global t
(unless smart-ime--keymaps-initialized
(smart-ime--init-keymaps)
(setq smart-ime--keymaps-initialized t))
(unless smart-ime-mode
(remove-hook 'post-command-hook 'smart-ime--post-command-handler))
(if (not smart-ime-mode)
(setq emulation-mode-map-alists (delq 'smart-ime--keymap-alist emulation-mode-map-alists))
(add-to-ordered-list 'emulation-mode-map-alists 'smart-ime--keymap-alist 400)
(setq smart-ime--ena-prefix-override-keymap t))
)
;;; Announce
(provide 'smart-ime)

Can't seem to get rid of Ctrl-x Ctrl-z Key Binding in Emacs for minimizing window ('suspend-frame)

I keep trying to get rid of this keybinding but setting it to nil or 'undo which would be fine with no luck. I am not sure why it even gets set to C-x C-z in the first place. I wouldn't even mind permanently removing the suspend-frame command if that would provide a solution.
Here is my .emacs file if it helps:
;;Style files and multi-file documents
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq inhibit-splash-screen t)
;; Use PDF mode by default
(setq-default TeX-PDF-mode t)
(setq TeX-save-query nil)
(global-auto-revert-mode t)
(global-set-key "\C-x C-z" nil)
(global-set-key "\C-z" nil)
;;Abbreviation mode and settings
(add-hook 'text-mode-hook (lambda () (abbrev-mode 1)))
(setq save-abbrevs t)
(quietly-read-abbrev-file)
;;Reftex and then turn on for Auctex
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
;;Enable preview latex
(load "preview-latex.el" nil t t)
;; For line numbers loading
(require 'linum)
(setq linum-format "%d ")
(global-linum-mode 1)
;; ===== Set the highlight current line minor mode =====
(global-hl-line-mode 1)
;; ===== Set standard indent to 2 rather that 4 ====
;;(setq standard-indent 2)
;; ========== Enable Line and Column Numbering ==========
;; Show line-number in the mode line
(line-number-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
;; ========== Force emacs to use tabs ==================
;; Turn on tabs
;;(setq indent-tabs-mode t)
;;(setq-default indent-tabs-mode t)
;; Bind the TAB key
;;(global-set-key (kbd "TAB") 'self-insert-command)
;; Set the tab width
;;(setq default-tab-width 4)
;;(setq tab-width 4)
;;(setq c-basic-indent 4)
(setq outline-minor-mode 1)
; Outline-minor-mode key map
(define-prefix-command 'cm-map nil "Outline-")
; HIDE
(define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
(define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
(define-key cm-map "o" 'hide-other) ; Hide other branches
(define-key cm-map "c" 'hide-entry) ; Hide this entry's body
(define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
(define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
; SHOW
(define-key cm-map "a" 'show-all) ; Show (expand) everything
(define-key cm-map "e" 'show-entry) ; Show this heading's body
(define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
(define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
(define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
; MOVE
(define-key cm-map "u" 'outline-up-heading) ; Up
(define-key cm-map "n" 'outline-next-visible-heading) ; Next
(define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
(define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
(define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
(global-set-key "\M-o" cm-map)
;;Display recent files
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 50)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; Allows hiding and folding
(defun turn-on-outline-minor-mode ()
(outline-minor-mode 1))
;;Flymake mode to check syntax on the fly
;;(require 'flymake)
;;(add-hook 'find-file-hook 'flymake-find-file-hook)
;;(defun flymake-get-tex-args (file-name)
;; (list "pdflatex" (list "-file-line-error" "-draftmode" "-interaction=nonstopmode" file-name)))
;;Fly spell mode
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(require 'tabbar)
; turn on the tabbar
(tabbar-mode t)
; define all tabs to be one of 3 possible groups: “Emacs Buffer”, “Dired”,
;“User Buffer”.
(defun tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
This function is a custom function for tabbar-mode's tabbar-buffer-groups.
This function group all buffers into 3 groups:
Those Dired, those user buffer, and those emacs buffer.
Emacs buffer are those starting with “*”."
(list
(cond
((string-equal "*" (substring (buffer-name) 0 1))
"Emacs Buffer"
)
((eq major-mode 'dired-mode)
"Dired"
)
(t
"User Buffer"
)
)))
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
(define-key global-map [(super j)] 'tabbar-backward)
(define-key global-map [(super k)] 'tabbar-forward)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(LaTeX-indent-level 4)
'(LaTeX-item-indent -2)
'(TeX-PDF-mode t)
'(TeX-auto-save t)
'(TeX-brace-indent-level 4)
'(TeX-command-list (quote (("doall" "%`%l%(mode)%' %t && bibtex %s && %`%l%(mode)%' %t && %`%l%(mode)%' %t && %V" TeX-run-TeX nil t :help "Run LaTeX BibTeX LaTeX LaTeX View") ("ebibno" "%`%l%(mode)%' %t && %`%l%(mode)%' %t && %`%l%(mode)%' %t && %V" TeX-run-TeX nil t :help "Run LaTeX View") ("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))))
'(TeX-debug-warnings t)
'(TeX-master nil)
'(TeX-source-correlate-method (quote synctex))
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server t)
'(TeX-view-program-list (quote (("Okular" "okular --unique %o#src:%n%b"))))
'(TeX-view-program-selection (quote (((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-pdf "Okular") (output-html "xdg-open"))))
'(column-number-mode t)
'(cua-enable-cua-keys t)
'(cua-mode t nil (cua-base)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans")))))
;;Switch to last recent buffer used with F11 or ShiftF11
(when (require 'bubble-buffer nil t)
(global-set-key [f11] 'bubble-buffer-next)
(global-set-key [(shift f11)] 'bubble-buffer-previous))
(setq bubble-buffer-omit-regexp "\\(^ .+$\\|\\*Messages\\*\\|*compilation\\*\\|\\*.+output\\*$\\|\\*TeX Help\\*$\\|\\*vc-diff\\*\\|\\*Occur\\*\\|\\*grep\\*\\|\\*cvs-diff\\*\\)")
(global-set-key "\M-n" (lambda () (interactive) (scroll-up 6)) )
(global-set-key "\M-p" (lambda () (interactive) (scroll-down 6)) )
(defun sfp-page-down (&optional arg)
(interactive "^P")
(setq this-command 'next-line)
(next-line
(- (window-text-height)
next-screen-context-lines)))
(put 'sfp-page-down 'isearch-scroll t)
(put 'sfp-page-down 'CUA 'move)
(defun sfp-page-up (&optional arg)
(interactive "^P")
(setq this-command 'previous-line)
(previous-line
(- (window-text-height)
next-screen-context-lines)))
(put 'sfp-page-up 'isearch-scroll t)
(put 'sfp-page-up 'CUA 'move)
(set-face-attribute 'default nil :height 100)
(setq cua-mode t)
(require 'latex)
(when (require 'browse-kill-ring nil 'noerror)
(browse-kill-ring-default-keybindings))
(global-set-key "\C-cy" '(lambda ()
(interactive)
(popup-menu 'yank-menu)))
(setq x-select-enable-clipboard t)
(define-key LaTeX-mode-map (read-kbd-macro "C-c C-a")
(lambda ()
(interactive)
(TeX-save-document (TeX-master-file))
(TeX-command "Doall" 'TeX-master-file -1)))
;;(autoload 'whizzytex-mode "whizzytex"
;;"WhizzyTeX, a minor-mode WYSIWYG environment for LaTeX" t)
;;Set up extra key-bindings for reftex
;;(setq reftex-extra-bindings t)
(defun my-latex-setup ()
(defun latex-word-count ()
(interactive)
(let* ((this-file (buffer-file-name))
(word-count
(with-output-to-string
(with-current-buffer standard-output
(call-process "texcount" nil t nil "-inc" "-brief" this-file)))))
(string-match "\n$" word-count)
(message (replace-match "" nil nil word-count))))
(define-key LaTeX-mode-map "\C-cw" 'latex-word-count)
(define-key LaTeX-mode-map "\C-xw" 'latex-word-count))
(add-hook 'LaTeX-mode-hook 'my-latex-setup t)
(global-set-key "\C-x C-z" 'undo)
(add-hook 'text-mode-hook (lambda ()
(local-set-key (kbd "C-c C-.")
(lambda () (interactive) (search-forward "." nil t)))))
(add-hook 'text-mode-hook (lambda ()
(local-set-key (kbd "C-c C-,")
(lambda () (interactive) (search-backward "." nil t)))))
(require 'ido)
(ido-mode t)
(fset 'yes-or-no-p 'y-or-n-p)
;(global-set-key (kbd "C-?") 'hippie-expand) not working
;(setq hippie-expand-try-functions-list '(try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol))
;;Save place in files between sessions
(require 'saveplace)
(setq-default save-place t)
;;Added windows.el configuration
(require 'windows)
;; -- load the saved windows automatically on boot
(add-hook 'window-setup-hook 'resume-windows)
;; -- use this command to quit and save your setup
(define-key ctl-x-map "C" 'see-you-again)
;; -- set up window saving !! Place at end of .emacs file
(win:startup-with-window)
Your string representation of C-x C-z needs adjusting. Try either of the following:
(global-set-key "\C-x\C-z" nil)
(global-set-key (kbd "C-x C-z") nil)
Or you can disable the suspend-frame command:
(put 'suspend-frame 'disabled t)
Try this:
(global-unset-key "\C-z")
(global-unset-key "\C-x\C-z")