似乎无法摆脱Emacs中的Ctrl-x Ctrl-z键绑定以最小化窗口('suspend-frame)

时间:2011-08-30 12:30:22

标签: emacs elisp emacs23 auctex

我一直试图摆脱这个键绑定,但将其设置为nil或'撤消哪个没关系,没有运气。我不确定为什么它首先被设置为C-x C-z。我甚至不介意永久删除suspend-frame命令,如果这可以提供解决方案。

如果有帮助,这是我的.emacs文件:

;;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)

2 个答案:

答案 0 :(得分:12)

您需要调整C-x C-z的字符串表示形式。请尝试以下任一操作:

(global-set-key "\C-x\C-z" nil)
(global-set-key (kbd "C-x C-z") nil)

或者您可以禁用suspend-frame命令:

(put 'suspend-frame 'disabled t)

答案 1 :(得分:7)

试试这个:

(global-unset-key "\C-z")
(global-unset-key "\C-x\C-z")