Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
emacs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DOSCH Philippe
emacs
Commits
e389b558
Commit
e389b558
authored
1 year ago
by
Philippe Dosch
Browse files
Options
Downloads
Patches
Plain Diff
odj-orj ajouté, création phil-macros & refactoring
parent
c747494c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.emacs
+3
-59
3 additions, 59 deletions
.emacs
.lisp/phil-macros.el
+82
-0
82 additions, 0 deletions
.lisp/phil-macros.el
with
85 additions
and
59 deletions
.emacs
+
3
−
59
View file @
e389b558
...
@@ -1058,74 +1058,18 @@
...
@@ -1058,74 +1058,18 @@
;; (ce qui permet d'ouvrir le nouveau folder à la place de l'ancien)
;; (ce qui permet d'ouvrir le nouveau folder à la place de l'ancien)
(put 'dired-find-alternate-file 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
;; Pour les quotes de mail trop longues (via insert-kbd-macro)
(use-package phil-macros)
(defun mailcut ()
"Format lines from quoted mails."
(interactive)
(end-of-line)
(kill-line)
(when (re-search-forward "[ >]*" nil t)
(replace-match " " nil t))
(just-one-space)
(end-of-line)
(gin-do-auto-fill))
;; Au niveau du mapping, c'est un peu tricky. Je n'ai pas trouvé le
;; Au niveau du mapping, c'est un peu tricky. Je n'ai pas trouvé le
;; moyen d'ajouter la touche contrôle, l'idée initiale étant de binder
;; moyen d'ajouter la touche contrôle, l'idée initiale étant de binder
;; ça sur la touche µ. J'ai récupéré le code dans un buffer dans lequel
;; ça sur la touche µ. J'ai récupéré le code dans un buffer dans lequel
;; j'ai exécuté toggle-enable-multibyte-characters (il faut utiliser
;; j'ai exécuté toggle-enable-multibyte-characters (il faut utiliser
;; le code décimal)
;; le code décimal)
(global-set-key [181] 'mailcut)
(global-set-key [181] 'mailcut)
(defvar scissors ">8 --------------------------------------------------------------- 8<"
"String to insert in \\[scissors].")
(defun scissors()
"Insert a line of SCISSORS in the buffer."
(interactive)
(insert scissors)
(forward-line 1))
(global-set-key (kbd "M-s c") 'scissors)
(global-set-key (kbd "M-s c") 'scissors)
(defun snip-lines-mail ()
"Delete all lines except the first three in the current buffer selection.
For the first and last remaining lines, remove all characters after the prefix
composed of spaces and '>'. For the middle line, remove all characters after
the prefix and insert '[snip]' after the remaining prefix."
(interactive)
(save-excursion
(let ((begin (region-beginning))
(end (region-end)))
(goto-char end)
(forward-line -1)
(setq end (point))
(goto-char begin)
(forward-line 2)
(setq begin (point))
(delete-region begin end)
(goto-char begin)
(forward-line -2)
(if (re-search-forward "^\\([ >]*\\)\\(.*\\)$" nil t)
(replace-match "" nil nil nil 2))
(forward-line 1)
(if (re-search-forward "^\\([ >]*\\)\\(.*\\)$" nil t)
(replace-match "[snip]" nil nil nil 2))
(forward-line 1)
(if (re-search-forward "^\\([ >]*\\)\\(.*\\)$" nil t)
(replace-match "" nil nil nil 2))
(forward-line 1))))
(global-set-key (kbd "M-s s") 'snip-lines-mail)
(global-set-key (kbd "M-s s") 'snip-lines-mail)
(defun cite-mail-part ()
"Prefix each line in the region with '> '."
(interactive)
(save-excursion
(let ((begin (region-beginning))
(end (region-end)))
(goto-char begin)
(while (< (point) end)
(beginning-of-line)
(insert "> ")
(forward-line 1)))))
(global-set-key (kbd "M-s t") 'cite-mail-part)
(global-set-key (kbd "M-s t") 'cite-mail-part)
(global-set-key (kbd "M-s o") 'odj-org)
;;; .emacs ends here
;;; .emacs ends here
(provide '.emacs)
(provide '.emacs)
...
...
This diff is collapsed.
Click to expand it.
.lisp/phil-macros.el
0 → 100644
+
82
−
0
View file @
e389b558
;;; phil-macros.el -- Phil's Macros
;;; Commentary:
;;; Code:
(
require
'gin-mode
)
;; Pour les quotes de mail trop longues (via insert-kbd-macro)
(
defun
mailcut
()
"Format lines from quoted mails."
(
interactive
)
(
end-of-line
)
(
kill-line
)
(
when
(
re-search-forward
"[ >]*"
nil
t
)
(
replace-match
" "
nil
t
))
(
just-one-space
)
(
end-of-line
)
(
gin-do-auto-fill
))
(
defvar
phil-scissors
">8 --------------------------------------------------------------- 8<"
"String to insert in \\[scissors]."
)
(
defun
scissors
()
"Insert a line of SCISSORS in the buffer."
(
interactive
)
(
insert
phil-scissors
)
(
forward-line
1
))
(
defun
snip-lines-mail
()
"Delete all lines except the first three in the current buffer selection.
For the first and last remaining lines, remove all characters after the prefix
composed of spaces and '>'. For the middle line, remove all characters after
the prefix and insert '[snip]' after the remaining prefix."
(
interactive
)
(
save-excursion
(
let
((
begin
(
region-beginning
))
(
end
(
region-end
)))
(
goto-char
end
)
(
forward-line
-1
)
(
setq
end
(
point
))
(
goto-char
begin
)
(
forward-line
2
)
(
setq
begin
(
point
))
(
delete-region
begin
end
)
(
goto-char
begin
)
(
forward-line
-2
)
(
if
(
re-search-forward
"^\\([ >]*\\)\\(.*\\)$"
nil
t
)
(
replace-match
""
nil
nil
nil
2
))
(
forward-line
1
)
(
if
(
re-search-forward
"^\\([ >]*\\)\\(.*\\)$"
nil
t
)
(
replace-match
"[snip]"
nil
nil
nil
2
))
(
forward-line
1
)
(
if
(
re-search-forward
"^\\([ >]*\\)\\(.*\\)$"
nil
t
)
(
replace-match
""
nil
nil
nil
2
))
(
forward-line
1
))))
(
defun
cite-mail-part
()
"Prefix each line in the region with '> '."
(
interactive
)
(
save-excursion
(
let
((
begin
(
region-beginning
))
(
end
(
region-end
)))
(
goto-char
begin
)
(
while
(
<
(
point
)
end
)
(
beginning-of-line
)
(
insert
"> "
)
(
forward-line
1
)))))
(
defun
odj-org
()
"Translate a text-based agenda to an org structure."
(
interactive
)
(
save-excursion
(
let
((
begin
(
region-beginning
))
(
end
(
region-end
)))
(
goto-char
begin
)
(
while
(
<
(
point
)
end
)
(
beginning-of-line
)
(
if
(
re-search-forward
"^\\([0-9]+[^ ]?\\) "
nil
t
)
(
replace-match
"***"
nil
nil
nil
1
))
(
forward-line
1
)))))
(
provide
'phil-macros
)
;;; phil-macros.el ends here
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment