Skip to content

Commit

Permalink
Merge pull request #14 from gabi6329/master
Browse files Browse the repository at this point in the history
Modification du header de emacs
Merci pour ta contribution
  • Loading branch information
kayofeld authored Nov 1, 2017
2 parents 6c51f19 + 6424e67 commit d2dea61
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 102 deletions.
13 changes: 4 additions & 9 deletions installation/.files/.emacs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
(setq emacs-lisp-dir "~/.emacs.d/"
my-elmode-dir (concat emacs-lisp-dir "elmodes/"))
(setq load-path
(append load-path (list my-elmode-dir)))

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

;; ----------------------------------
;; EPITECH CONFIG
;; ----------------------------------
(add-to-list 'load-path "~/.emacs.d/lisp")
(load "std.el")
(load "std_comment.el")
(if (file-exists-p "~/.myemacs")
(load-file "~/.myemacs"))
22 changes: 11 additions & 11 deletions installation/.files/.emacs.d/epitech/std.el
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
;;
;; div.el for emacs conf in site-local
;;
;; Made by Nicolas Sadirac
;; Login <[email protected]>
;;
;; Started on Sun Oct 17 02:20:57 1993 Nicolas Sadirac
;; Last update Thu Jul 8 12:47:38 2010 root
;; EPITECH PROJECT, 2017
;; emacs configuration
;; File description:
;; global emacs configuration to help students
;;

(defun do_insert_time ()
(interactive)
(insert-string (current-time-string)))
(set-variable 'c-argdecl-indent 0)


(normal-erase-is-backspace-mode 0)

; Define keyboard shortcuts
(global-set-key "" 'backward-delete-char)
(global-set-key "" 'compile)
(global-set-key "" 'goto-line)

; Adjust indentation settings
(setq c-default-style "linux"
c-basic-offset 8
tab-width 8
indent-tabs-mode t)
97 changes: 15 additions & 82 deletions installation/.files/.emacs.d/epitech/std_comment.el
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
;;
;; StdComment.el for Emacs in ~/Emacs
;;
;; Made by Frederic Denis
;; Login <[email protected]>
;;
;; Started on Thu Sep 9 23:34:05 1993 Frederic Denis
;; Last update Tue Nov 29 18:42:22 2016 Paul Montague
;; EPITECH PROJECT, 2017
;; emacs configuration
;; File description:
;; standard epitech header configuration
;;
;; Based on Comment routines by Isaac
;;

(if (file-exists-p "/usr/school/etc/emacs/php-mode.el")
(load-file "/usr/school/etc/emacs/php-mode.el"))

(add-to-list 'auto-mode-alist (cons "\\.php[0-9]*$" 'php-mode))

(global-set-key "h" 'update-std-header)
(global-set-key "" 'do_insert_time)
(global-set-key "" 'std-file-header)


(setq header-made-by "Made by "
header-login "Login "
header-login-beg "<"
header-login-mid ""
header-login-end ">"
header-started "Started on "
header-last "Last update "
header-for " for "
header-in " in "
domaine-name "")
(if (setq user-nickname (getenv "USER_NICKNAME"))
t
(setq user-nickname (user-full-name))
)

(setq write-file-hooks (cons 'update-std-header write-file-hooks))
(setq header-epitech "EPITECH PROJECT, "
header-description "File description:")

(setq std-c-alist '( (cs . "/*") (cc . "** ") (ce . "*/") )
std-css-alist '( (cs . "/*") (cc . "** ") (ce . "*/") )
Expand Down Expand Up @@ -91,72 +63,33 @@
(cdr (assoc a (eval (cdr (assoc mode-name std-modes-alist)))))
)

(defun update-std-header ()
"Updates std header with last modification time & owner.\n(According to mode)"
(interactive)
(save-excursion
(if (buffer-modified-p)
(progn
(goto-char (point-min))
(if (search-forward header-last nil t)
(progn
; (delete-region (point-at-bol) (point-at-eol))
(delete-region
(progn (beginning-of-line) (point))
(progn (end-of-line) (point)))
(insert-string (concat (std-get 'cc)
header-last
(current-time-string)
" "
user-nickname))
(message "Last modification header field updated."))))))
nil)

(defun std-file-header ()
"Puts a standard header at the beginning of the file.\n(According to mode)"
(interactive)
(goto-char (point-min))
(let ((projname "toto")(location "tiuti"))
(let ((projname "toto")(projdescription "tiuti"))
(setq projname (read-from-minibuffer
(format "Type project name (RETURN to quit) : ")))
(setq location (getenv "PWD"))
(setq projdescription (read-from-minibuffer
(format "Type short file description (RETURN to quit) : ")))

(insert-string (std-get 'cs))
(newline)
(insert-string (concat (std-get 'cc)
(buffer-name)
header-for
projname
header-in
location))
(newline)
(insert-string (std-get 'cc))
(newline)
(insert-string (concat (std-get 'cc) header-made-by user-nickname))
header-epitech
(format-time-string "%Y")))
(newline)
(insert-string (concat (std-get 'cc)
header-login
header-login-beg
(getenv "USER")
header-login-mid
domaine-name
header-login-end))
(newline)
(insert-string (std-get 'cc))
projname))
(newline)
(insert-string (concat (std-get 'cc)
header-started
(current-time-string)
" "
user-nickname))
header-description))
(newline)
(insert-string (concat (std-get 'cc)
header-last
(current-time-string)
" "
user-nickname))
projdescription))
(newline)
(insert-string (std-get 'ce))
(newline)
(newline)))

(defun insert-std-vertical-comments ()
Expand Down

0 comments on commit d2dea61

Please sign in to comment.