[LUGOS] Emacs in sumniki

Gregor GORJANC gregor.gorjanc at bfro.uni-lj.si
Mon Aug 9 11:35:51 CEST 2004


Zdravo!

Uros Trebec wrote:
> OK, fantje, najlepsa hvala za pomoc! :)
> 
> Gregor, a bi bil pripravljen na eno izmenjavo .emacs fajlov? 
> 

Ja, seveda.

Kot rečeno, sem ravno prešel na emacs in še nisem imel kaj veliko časa za 
konfiguracijo tega odličnega urejevalnika. Spodaj sem priložil vsebino, ki 
pa je daleč od dodelanega. Nekaj mi celo šteka, pa še nisem ugotovil kaj. 
Večino vsebine sem dobil preko menijev za konfiguracijo.

Pri xemacs-u sem kar precej čaral z nastavitvami, a sem kasneje ugotovil, 
da je lahko to tudi pain in the ass, ker nekatere zadeve niso delovale 
globalno. Sedaj, ko sem presedlal na emacs, sem se odločil, da bom prebral 
emacs manual in urjal konfiguracijo bolj postopoma, vsak dan kakšno malenkost.

Datoteke so ločene s črto!

---------------------------------------------------------------
;; .emacs
(custom-set-variables
   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
   ;; Your init file should contain only one such instance.
  '(fill-column 75)
  '(follow-auto t)
  '(global-auto-revert-mode t nil (autorevert))
  '(global-font-lock-mode t nil (font-lock))
  '(global-hl-line-mode t nil (hl-line))
  '(highlight-wrong-size-font nil t)
  '(mouse-avoidance-mode (quote animate) nil (avoid))
  '(mouse-wheel-mode t nil (mwheel))
  '(pc-selection-mode t nil (pc-select))
  '(query-replace-highlight t)
  '(recentf-mode t nil (recentf))
  '(recentf-save-file "/home/ggorjan/.emacs.d/.recentf")
  '(search-highlight t)
  '(show-paren-mode t nil (paren))
  '(standard-indent 2)
  '(tab-always-indent t)
  '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
  '(transient-mark-mode t)
  '(uniquify-buffer-name-style (quote forward) nil (uniquify))
)

;; Dont show the GNU splash screen
(setq inhibit-startup-message t)

;; Frame size.
(set-frame-height (selected-frame) 45)
(set-frame-width (selected-frame) 110)

;; Modeline
;; Column and line number
(column-number-mode t)
(line-number-mode t)
;; Time in 24h format
(display-time)
(setq display-time-24hr-format t)
;; Strings displayed for end-of-line format in file
(setq eol-mnemonic-undecided "\(?\)")
(setq eol-mnemonic-unix "\(unix\)")
(setq eol-mnemonic-doc "\(dos\)")
(setq eol-mnemonic-mac "\(mac\)")
;; Make all "yes or no" prompts show "y or n" instead
(fset 'yes-or-no-p 'y-or-n-p)

;; Faces configuration
(custom-set-faces
   ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
   ;; Your init file should contain only one such instance.
)
(set-cursor-color "red") ; red cursor
(message " --> Faces customization")

;; My .el files
(setq load-path (append load-path '("~/.emacs.d/")))

;; CUA mode - copy, cut, paste and undo and some more other usuall PC stuff
;; Downloaded from http://www.cua.dk/cua.html --> look at cua.el
(require 'cua)
(CUA-mode t)
(message " --> CUA mode (cua.el)")

;; Keybindgs customization
;; Usuall PC stuff defined with CUA mode
;(require 'mykeys)
;;(message " --> Keybindings (mykeys.el)")

;; Mouse

;; Emacs server --> look at myserver.el
(require 'myserver)
(put 'downcase-region 'disabled nil) ; ??
(message " --> Emacs server (myserver.el)")

;; Match parenthesis
(show-paren-mode t)

;; White space mode
(setq nuke-trailing-whitespace-in-hooks (quote (write-file-hooks)) nil 
(nuke-trailing-whitespace))
(setq nuke-trailing-whitespace-p (quote nuke-trailing-whitespace-check-mode))
(setq whitespace-auto-cleanup t)
(setq whitespace-check-trailing-whitespace t)
(setq whitespace-global-mode t nil (whitespace))
;; No new line at end
(setq next-line-add-newlines nil)

;; Tabulator
(setq default-tab-width 2)

;; Backup
(setq make-backup-files t)

;; Uncompress files
(auto-compression-mode t)

;; Autoinsert - templates
(setq auto-insert t)
(setq auto-insert-mode t nil (autoinsert))
(setq auto-insert-query t)
(setq auto-insert-directory "~/.emacs.d/")
(message " --> Autoinsert")

;; Language settings
;(setq keyboard-coding-system nil)
;(setq current-language-environment "utf-8")
;(setq default-input-method "utf-8")

;; TeX
(setq bib-file "~/pisanje/literatura/literatura.bib")
(setq unread-bib-file " ~/pisanje/literatura/literaturaTODO.bib")

---------------------------------------------------------------

;; cua.el datoteko sem dobil na netu http://www.cua.dk/

---------------------------------------------------------------
;;; myserver.el --- start server for emacs editor

;; Copyright (C) 2004  Free Software Foundation, Inc.

;; Author: Gregor GORJANC <gregor.gorjanc <at> bfro.uni-lj.si>
;; Keywords: extensions

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file 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.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Start emacs server and launch some additional code related to it

;;; Code:

;; Starting emacsclient. You can open new buffer in existing frame with
;; emacsclient from terminal.
(server-start)
(setq server-switch-hook (quote (raise-frame)))

;; If you have changed the buffer since your last save, Emacs will ask you:
;; Revert buffer from file ...? (yes or no). You will probably always want
;; to say no here, since reverting means that the file is reread from disk,
;; causing all your changes since the last save to be lost!  gnuclient's
;; behavior of silently reloading the changed buffer is probably preferable
;; add the following lines to your .emacs file to emulate gnuclient's
;; behavior with emacsclient:
;; http://docs.kde.org/en/3.2/kdegraphics/kdvi/inverse-search-editor.html

(defadvice server-visit-files (around save-buffers last activate)
   "Try to emulate gnuclient behavior with emacsclient.
Works only for visiting one buffer at a time."
   (let* ((filen (car (car (ad-get-arg 0))))
	 (buf (get-file-buffer filen))
	 (this-buf-modified-p nil))
     ;;; the following is copied from server-visit-files, with
     ;;; a modification for the `verify-visited-file-modtime' test
     (if (and buf (set-buffer buf))
	(if (file-exists-p filen)
	    ;;; if the file has changed on disk, reload it
	    ;;; using `find-file-noselect'
	    (if (not (verify-visited-file-modtime buf))
		(progn
		  (find-file-noselect filen)
		  ;;; if user answered `no', reset modtime anyway
		  ;;; so that server-visit-files doesn't realize the
		  ;;; difference:
		  (set-visited-file-modtime)))
	  ;;; if file exists no longer, we let server-visit-files
	  ;;; deal with that
	  t)
       (setq buf (find-file-noselect filen)))
     (setq this-buf-modified-p (buffer-modified-p buf))
     (set-buffer buf)
     (set-buffer-modified-p nil)
     ad-do-it
     (set-buffer-modified-p this-buf-modified-p)))

(provide 'myserver)
;;; myserver.el ends here
---------------------------------------------------------------

-- 
Lep pozdrav / With regards,
     Gregor GORJANC




More information about the lugos-list mailing list