LINUX.ORG.RU

сделал неработоспособную конфигурацию Emacs

 , ,


0

1

При включении predictive-mode, когда работаю с .Rnw-файлами (ESS, auctex) ввод начинает заметно подлагивать, скорость появления символов на экране сильно отстаёт от скорости печати, через какое-то время Emacs зависает, отжирая 100% процессорного времени. Без predictive-mode всё работает нормально.

$ cat ~/.emacs

   (defun filter (condp lst)
     (delq nil 
           (mapcar (lambda (x) (and (funcall condp x) x)) lst)))
   (mapc (lambda (dir) (add-to-list 'load-path dir))
         (filter 'file-accessible-directory-p
                 (mapcar (lambda (p) (concat p "/../share/emacs/site-lisp"))
                         (split-string (getenv "PATH") ":"))))

;EL-GET:
;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

(unless (require 'el-get nil 'noerror)
  (require 'package)
  (add-to-list 'package-archives
               '("melpa" . "http://melpa.org/packages/"))
  (package-refresh-contents)
  (package-initialize)
  (package-install 'el-get)
  (require 'el-get))

(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
(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.
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" "#729fcf" "#eeeeec"])
 '(custom-enabled-themes (quote (whiteboard)))                                                                                                                                               
 '(package-selected-packages (quote (el-get))))                                                                                                                                              
(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.                                                                                                                                        
 )
;/EL-GET;

;ORG-MODE:
;; Enable org-mode
(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

;/ORG-MODE;


;FONTS:
;; Change the default font for new (non special-display) frames,
(add-to-list 'default-frame-alist '(font . "Hack-14" )) 
(set-face-attribute 'default t :font "Hack-14" )
;; Change the default font for the current frame, as well as future frames
(set-face-attribute 'default nil :font "Hack-14" )
(set-frame-font "Hack-14" nil t)
;/FONTS;


;THEMES:


;/THEMES;


;TEX:
(require 'tex-site)
(setq TeX-auto-save t)
    (setq TeX-parse-self t)
    (setq-default TeX-master nil)
    (add-hook 'LaTeX-mode-hook 'visual-line-mode)
    (add-hook 'LaTeX-mode-hook 'flyspell-mode)
    (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
    (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
    ;(add-hook 'LaTeX-mode-hook 'preview-latex)
(setq reftex-plug-into-AUCTeX t)

;; ESS
(setq load-path (cons "/home/croll/.emacs.d/ess-16.10/lisp/" load-path))
(require 'ess-site)

(setq-default TeX-engine 'xetex)
(setq-default TeX-PDF-mode t)
;/TEX;

;LOCALE:
(defun cfg:reverse-input-method (input-method)
  "Build the reverse mapping of single letters from INPUT-METHOD."
  (interactive
   (list (read-input-method-name "Use input method (default current): ")))
  (if (and input-method (symbolp input-method))
      (setq input-method (symbol-name input-method)))
  (let ((current current-input-method)
        (modifiers '(nil (control) (meta) (control meta))))
    (when input-method
      (activate-input-method input-method))
    (when (and current-input-method quail-keyboard-layout)
      (dolist (map (cdr (quail-map)))
        (let* ((to (car map))
               (from (quail-get-translation
                      (cadr map) (char-to-string to) 1)))
          (when (and (characterp from) (characterp to))
            (dolist (mod modifiers)
              (define-key local-function-key-map
                (vector (append mod (list from)))
                (vector (append mod (list to)))))))))
    (when input-method
      (activate-input-method current))))

(cfg:reverse-input-method 'russian-computer)
;/LOCALE;


;FLYSPELL:
;; список используемых нами словарей
(setq ispell-local-dictionary-alist
    '(("russian"
       "[АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯабвгдеёжзийклмнопрстуфхцчшщьыъэюя]"
       "[^АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯабвгдеёжзийклмнопрстуфхцчшщьыъэюя]"
       "[-]"  nil ("-d" "ru_RU") nil utf-8)
      ("english"
       "[A-Za-z]" "[^A-Za-z]"
       "[']"  nil ("-d" "en_US") nil iso-8859-1)))
       
       ;; вместо aspell использовать hunspell
(setq ispell-really-aspell nil
      ispell-really-hunspell t)

;; полный путь к нашему пропатченному hunspell
(setq ispell-program-name "/run/current-system/sw/bin/hunspell")
;/FLYSPELL;


;PREDICTIVE:
;; predictive install location
     (add-to-list 'load-path "~/.emacs.d/predictive/")
     ;; dictionary locations
     (add-to-list 'load-path "~/.emacs.d/predictive/latex/")
     (add-to-list 'load-path "~/.emacs.d/predictive/texinfo/")
     (add-to-list 'load-path "~/.emacs.d/predictive/html/")
     ;; load predictive package
(require 'predictive)
;/PREDICTIVE;

;;;;HIGHLIGT
;;activate show paren
(show-paren-mode t)   
(setq show-paren-style 'expression) ; подсвечивает блоки, но раздражает
;;Парные скобки
(require 'autopair)
(autopair-global-mode)

;;Подсветка
(add-hook 'highlight-parentheses-mode-hook
          '(lambda ()
             (setq autopair-handle-action-fns
                   (append
                                        (if autopair-handle-action-fns
                                                autopair-handle-action-fns
                                          '(autopair-default-handle-action))
                                        '((lambda (action pair pos-before)
                                            (hl-paren-color-update)))))))

(define-globalized-minor-mode global-highlight-parentheses-mode
  highlight-parentheses-mode
  (lambda ()
    (highlight-parentheses-mode t)))
(global-highlight-parentheses-mode t)

;;;
Deleted

Последнее исправление: frigate_freedom (всего исправлений: 1)

predictive-mode

Ознакомился, https://www.emacswiki.org/emacs/PredictiveMode
Такое эталонное ненужно, что можно сразу в палату мер и весов.

Ну и вообще, если в емаксе хотеть мгновенные посимвольные попапы с вариантами дополнений, то тормоза неизбежны.
Пока все бекэнды будут опрошены, можно с разгону и слово допечатать.

Вон в документации к company-mode пишут, что нет смысла вручную задавать бекэнды под режим, т.к. company и сам может быстро сообразить что к чему.
Неправда это. Пока так и остался на ac с ограниченным под режимы набором sources.

aidaho ★★★★★
()
Ответ на: комментарий от aidaho

Вот я сейчас поставил auto-complete, скопировал конфиг из первого коммента: http://emacs.stackexchange.com/questions/5938/how-to-make-auto-complete-work-...

Теперь в документе не работает переключение языка. В системе он переключается, в Emacs — нет.

Deleted
()
Ответ на: комментарий от Deleted

Хотя, похоже, что и не в predictive дело.

Если быстро набрать «\begin{equation} RET RET», то он так же повисает, кулер начинает шуметь из-за всех сил, а одно из ядер процессора грузится на 100%.

Наверно, где-то со скобками намудрил.

Deleted
()
Ответ на: комментарий от Deleted

Дело в конкретном документе, судя по всему.

Зависает на вводе «\begin{equation}». В minimal-exaple.Rnw от yihui всё работает нормально.

Deleted
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.