Emacs: Difference between revisions
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Whole Dot Emacs = | = Whole Dot Emacs = | ||
< | <syntaxhighlight lang="lisp"> | ||
;; iso-latin-1 | ;; iso-latin-1 | ||
;;(defun recenter-10 () | ;;(defun recenter-10 () | ||
Line 333: | Line 333: | ||
(set-fontset-font | (set-fontset-font | ||
t 'symbol (font-spec :family "Noto Color Emoji") nil 'prepend)) | t 'symbol (font-spec :family "Noto Color Emoji") nil 'prepend)) | ||
</ | </syntaxhighlight> |
Revision as of 05:34, 25 October 2023
Yank from Primary Selection
In Linux, the "highlight" buffer is called the Primary Selection.
(defun yank-primary-selection ()
(interactive)
(insert (x-get-selection 'PRIMARY)))
(global-set-key (kbd "M-y") 'yank-primary-selection)
Whole Dot Emacs
;; iso-latin-1
;;(defun recenter-10 ()
;; (recenter "10"))
;; not necessary - use xmodmap -e "keysym Alt_L = Meta_L Alt_L"
;; (set-keyboard-coding-system 'iso-latin-1)
;; (require 'vc-svn)
;; (require 'psvn)
;disable backup
(setq backup-inhibited t)
;disable auto save
(setq auto-save-default nil)
(setq js-indent-level 2)
; (setq tab-width 2)
; (setq web-mode-code-indent-offset 4)
(setq visible-bell 1)
(global-set-key "\M-\C-f" 'font-lock-mode)
(global-set-key "\C-t" 'not-defined)
(global-set-key "\C-x\C-x" 'not-defined)
(global-set-key "\C-hn" 'not-defined)
(global-set-key "\C-h\C-n" 'not-defined)
(global-set-key "\C-x\C-?" 'not-defined)
(global-set-key "\M-\C-v" 'revert-buffer)
(global-set-key "\C-z" 'not-defined)
(global-set-key "\C-o" 'undefined)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\C-x\C-u" 'uncomment-region)
(global-set-key "\C-x\C-c" 'comment-region)
(global-set-key "\C-x\C-z" 'not-defined)
;; (global-set-key "\C-l" 'recenter-10)
(defun debug ())
(defun overwrite-mode ())
(set-background-color "gray5")
(set-foreground-color "wheat")
;; (set-default-font "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1")
;; (set-default-font "-misc-fixed-medium-r-normal--13-*-*-*-c-70-iso8859-1")
;; (set-default-font "-misc-fixed-medium-r-normal--15-*-*-*-c-90-iso8859-1")
;; (set-default-font "-1ASC-Liberation Mono-normal-normal-normal-*-19-*-*-*-m-0-fontset-auto2")
;; (set-default-font "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-19-*-*-*-m-0-iso10646-1")
;; (set-frame-font "-DAMA-Ubuntu Mono-bold-normal-normal-*-19-*-*-*-m-0-fontset-auto9" nil t)
;; (set-default-font
;;"-Misc-Fixed-Medium-O-SemiCondensed--13-120-75-75-C-60-ISO8859-1")
;;"-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1")
;; "-misc-fixed-medium-r-normal--20-*-*-*-c-100-iso8859-1")
;; ("11x18" "-misc-fixed-medium-r-normal--18-*-*-*-c-110-iso8859-1" "11x18") ("12x24" "-misc-fixed-medium-r-normal--24-*-*-*-c-120-iso8859-1" "12x24") ("") ("clean 5x8" "-schumacher-clean-medium-r-normal--8-*-*-*-c-50-iso8859-1") ("clean 6x8" "-schumacher-clean-medium-r-normal--8-*-*-*-c-60-iso8859-1") ("clean 8x8" "-schumacher-clean-medium-r-normal--8-*-*-*-c-80-iso8859-1") ("clean 8x10" "-schumacher-clean-medium-r-normal--10-*-*-*-c-80-iso8859-1") ("clean 8x14" "-schumacher-clean-medium-r-normal--14-*-*-*-c-80-iso8859-1") ("clean 8x16" "-schumacher-clean-medium-r-normal--16-*-*-*-c-80-iso8859-1") ("") ("sony 8x16" "-sony-fixed-medium-r-normal--16-*-*-*-c-80-iso8859-1")) ("Courier" ("8" "-adobe-courier-medium-r-normal--*-80-*-*-m-*-iso8859-1") ("10" "-adobe-courier-medium-r-normal--*-100-*-*-m-*-iso8859-1") ("12" "-adobe-courier-medium-r-normal--*-120-*-*-m-*-iso8859-1") ("14" "-adobe-courier-medium-r-normal--*-140-*-*-m-*-iso8859-1") ("18" "-adobe-courier-medium-r-normal--*-180-*-*-m-*-iso8859-1") ("24" "-adobe-courier-medium-r-normal--*-240-*-*-m-*-iso8859-1") ("8 bold" "-adobe-courier-bold-r-normal--*-80-*-*-m-*-iso8859-1") ("10 bold" "-adobe-courier-bold-r-normal--*-100-*-*-m-*-iso8859-1") ("12 bold" "-adobe-courier-bold-r-normal--*-120-*-*-m-*-iso8859-1") ("14 bold" "-adobe-courier-bold-r-normal--*-140-*-*-m-*-iso8859-1") ("18 bold" "-adobe-courier-bold-r-normal--*-180-*-*-m-*-iso8859-1") ("24 bold" "-adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1") ("8 slant" "-adobe-courier-medium-o-normal--*-80-*-*-m-*-iso8859-1") ("10 slant" "-adobe-courier-medium-o-normal--*-100-*-*-m-*-iso8859-1") ("12 slant" "-adobe-courier-medium-o-normal--*-120-*-*-m-*-iso8859-1") ("14 slant" "-adobe-courier-medium-o-normal--*-140-*-*-m-*-iso8859-1") ("18 slant" "-adobe-courier-medium-o-normal--*-180-*-*-m-*-iso8859-1") ("24 slant" "-adobe-courier-medium-o-normal--*-240-*-*-m-*-iso8859-1") ("8 bold slant" "-adobe-courier-bold-o-normal--*-80-*-*-m-*-iso8859-1") ("10 bold slant" "-adobe-courier-bold-o-normal--*-100-*-*-m-*-iso8859-1") ("12 bold slant" "-adobe-courier-bold-o-normal--*-120-*-*-m-*-iso8859-1") ("14 bold slant" "-adobe-courier-bold-o-normal--*-140-*-*-m-*-iso8859-1") ("18 bold slant" "-adobe-courier-bold-o-normal--*-180-*-*-m-*-iso8859-1") ("24 bold slant" "-adobe-courier-bold-o-normal--*-240-*-*-m-*-iso8859-1")) ("Fontset" ("standard: 16-dot medium" "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard") ("startup: 13-dot bold" "-*-*-bold-R-SemiCondensed-*-13-120-75-75-C-60-fontset-startup") ("startup: 13-dot medium" "-*-*-Medium-R-SemiCondensed--13-120-75-75-C-60-fontset-startup") ("startup: 13-dot medium slant" "-*-*-Medium-o-SemiCondensed-*-13-120-75-75-C-60-fontset-startup
;;"-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1")
;; (hscroll-global-mode)
(set-default 'truncate-lines nil)
(setq truncate-lines nil)
(set-default 'truncate-partial-width-windows nil)
(setq truncate-partial-width-windows nil)
(setq never-dont-truncate-any-windows-you-stupid-pussbag t)
(setq transient-mark-mode t)
(global-font-lock-mode)
(setq show-paren-mode t)
;; (add-to-list 'load-path (expand-file-name "/usr/share/emacs/site-lisp/tdtd"))
;; (load-file "/usr/share/emacs/site-lisp/tdtd/tdtd.el")
;; ---------------------------------------------------------
;; PSGML - XXML Mode
;; (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
;; (autoload 'html-mode "xxml" "Major mode to edit HTML files." t)
;; (autoload 'xxml-mode-routine "xxml")
;; (add-hook 'sgml-mode-hook 'xxml-mode-routine)
;; ------------------------------------------------------------
(autoload 'web-mode "js" "Major mode to edit web files." t)
(autoload 'web-mode "css" "Major mode to edit web files." t)
;; ----------------------------------------------------------
;; ANT MODE STUFF
;; (load-file "/usr/local/share/emacs/site-lisp/ant.elc")
;; -----------------------------------------------------------
;; JDE STUFF
;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/site-lisp/jde/lisp"))
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/site-lisp/semantic"))
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/site-lisp/speedbar"))
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/site-lisp/elib"))
(add-to-list 'load-path (expand-file-name "/usr/local/share/emacs/site-lisp/eieio"))
;; -------------------------------------------------------------------
;; POV STUFF
; (add-to-list 'load-path (expand-file-name "/usr/share/emacs/site-lisp/pov-mode"))
; (require 'pov-mode)
; (setq auto-mode-alist
; (cons '("\\.pov$" . pov-mode) auto-mode-alist))
;; (require 'jde)
;; (load-file "/usr/local/share/emacs/site-lisp/my-jde-templates.elc")
; ;; Sets the basic indentation for Java source files
; ;; to two spaces.
;; (defun my-jde-mode-hook ()
;; (setq c-basic-offset 4))
;; (add-hook 'jde-mode-hook 'my-jde-mode-hook)
; ;; Include the following only if you want to run
; ;; bash as your shell.
; ;; Setup Emacs to run bash as its primary shell.
;; (setq shell-file-name "bash")
;; (setq shell-command-switch "-c")
;; (setq explicit-shell-file-name shell-file-name)
;; (setenv "SHELL" shell-file-name)
;; (setq explicit-sh-args '("-login" "-i"))
;; END JDE STUFF
;; ------------------------------------------------------------
;; ;; PYTHON MODE
;; (require 'python-mode)
;; (load-file "/usr/local/share/emacs/site-lisp/python-mode.el")
;; (setq auto-mode-alist
;; (cons '("\\.py$" . python-mode) auto-mode-alist))
;; (setq interpreter-mode-alist
;; (cons '("python" . python-mode)
;; interpreter-mode-alist))
;; (load-file "/usr/local/share/emacs/site-lisp/starteam.elc")
;; (setq starteam-host "172.29.65.27" ; or "myMachine.myCompany.com"
;; starteam-port 49203
;; starteam-user "rbbushma"
;; starteam-password "een91ax"
;; starteam-executable "stcmd"
;; starteam-debug t
;; starteam-to-directory-alist
;; (list
;; (cons "^/home/bob/projects/galaxy"
;; "^/home/bob/projects/rpt" )))
;; (starteam-menubar-setup)
(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.
'(debug-on-error nil)
'(indent-tabs-mode nil)
'(jde-compiler (quote ("javac" "")))
'(jde-db-source-directories
(quote
("/home/bob/projects/galaxy/test" "/home/bob/projects/galaxy/src")))
'(jde-gen-code-templates
(quote
(("Get Set Pair" . jde-gen-get-set)
("toString method" . jde-gen-to-string-method)
("Action Listener" . jde-gen-action-listener)
("Window Listener" . jde-gen-window-listener)
("Mouse Listener" . jde-gen-mouse-listener)
("Mouse Motion Listener" . jde-gen-mouse-motion-listener)
("Inner Class" . jde-gen-inner-class)
("println" . jde-gen-println)
("beep" . jde-gen-beep)
("property change support" . jde-gen-property-change-support)
("EJB Entity Bean" . jde-gen-entity-bean)
("EJB Session Bean" . jde-gen-session-bean)
("Hello World" . tempo-template-hello))))
'(jde-run-application-class "")
'(jde-run-working-directory "")
'(next-line-add-newlines nil)
'(pc-select-meta-moves-sexps t)
'(pc-select-selection-keys-only t)
'(pc-selection-mode t t)
'(show-paren-mode t)
'(tab-width 4)
'(tool-bar-mode nil nil (tool-bar)))
(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 (:family "Ubuntu Mono" :foundry "DAMA" :slant normal :weight bold :height 151 :width normal)))))
(put 'upcase-region 'disabled nil)
; these functions convert the file to DOS/UNIX/Mac format
(defun dos-line-endings ()
"sets the buffer-file-coding-system to undecided-dos; changes the buffer
by invisibly adding carriage returns"
(interactive)
(set-buffer-file-coding-system 'undecided-dos nil))
(defun unix-line-endings ()
"sets the buffer-file-coding-system to undecided-unix; changes the buffer
by invisibly removing carriage returns"
(interactive)
(set-buffer-file-coding-system 'undecided-unix nil))
(defun mac-line-endings ()
"sets the buffer-file-coding-system to undecided-mac; may change the buffer
by invisibly removing carriage returns"
(interactive)
(set-buffer-file-coding-system 'undecided-mac nil))
;======================================================================
; chmod a+w / chmod a-w
; Coded on 1996/06/11 02:22:30 by Gaku UEDA
; gaku@ueda.info.waseda.ac.jp
; Absolutely no warranty.
(defun gaku-toggle-executable-bits-of-current-buffer ()
(interactive)
; toggle exec bit.
(let* (strset
(bfname (buffer-file-name))
(fmode (file-modes bfname))
new-fmode
)
(cond ((gaku-executable-bits-p fmode)
(setq new-fmode (gaku-unset-executable-bits fmode)) ; unset
(setq strset "Unset"))
(t (setq new-fmode (gaku-set-executable-bits fmode)) ; set
(setq strset "Set")))
(set-file-modes bfname new-fmode) ; exact operation
(message (format "%s executable bit of %s and become '%s'" strset bfname (gaku-enstr-permission new-fmode))))) ; inform through mini-buffer
(defun toggle-write-bits-of-current-buffer ()
(interactive)
; toggle write bit.
(let* (strset
(bfname (buffer-file-name))
(fmode (file-modes bfname))
new-fmode
)
(cond ((gaku-write-bits-p fmode)
(setq new-fmode (gaku-unset-write-bits fmode)) ; unset
(setq strset "Unset"))
(t (setq new-fmode (gaku-set-write-bits fmode)) ; set
(setq strset "Set")))
(set-file-modes bfname new-fmode) ; exact operation
(message (format "%s write bit of %s and become '%s'" strset bfname (gaku-enstr-permission new-fmode))))) ; inform through mini-buffer
; ex) 123 => "--xrwx-wx"
(defun gaku-enstr-permission (pattern)
(let (u g o)
(setq o (gaku-enstr-permission-3 (mod pattern 8)))
(setq pattern (/ pattern 8))
(setq g (gaku-enstr-permission-3 (mod pattern 8)))
(setq pattern (/ pattern 8))
(setq u (gaku-enstr-permission-3 pattern))
(format "%s%s%s" u g o)))
; 7 => 'rwx' 5 => 'r-x'
; gaku-enstr-permission
(defun gaku-enstr-permission-3 (pattern)
(let (r w x)
(cond ((gaku-test pattern 4) (setq r "r"))
(t (setq r "-")))
(cond ((gaku-test pattern 2) (setq w "w"))
(t (setq w "-")))
(cond ((gaku-test pattern 1) (setq x "x"))
(t (setq x "-")))
(format "%s%s%s" r w x)))
(defun gaku-test (n m)
(= (logand n m) m))
; chmod a+x
(defun gaku-set-executable-bits (pattern)
(logior pattern 73))
; chmod a-x
(defun gaku-unset-executable-bits (pattern)
(logand pattern 438))
(defun gaku-executable-bits-p (pattern)
(> (logand pattern 73) 0))
; chmod a+w
(defun gaku-set-write-bits (pattern)
(logior pattern 146))
; chmod a-w
(defun gaku-unset-write-bits (pattern)
(logand pattern 365))
(defun gaku-write-bits-p (pattern)
(> (logand pattern 2) 0))
;; (global-set-key "\C-cx" 'gaku-toggle-executable-bits-of-current-buffer)
(global-set-key "\C-\M-w" 'toggle-write-bits-of-current-buffer)
(defun yank-primary-selection ()
(interactive)
(insert (x-get-selection 'PRIMARY)))
(global-set-key (kbd "M-y") 'yank-primary-selection)
(global-set-key (kbd "M-r") 'rectangle-mark-mode)
(when (member "Noto Color Emoji" (font-family-list))
(set-fontset-font
t 'symbol (font-spec :family "Noto Color Emoji") nil 'prepend))