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
bccd4129
Commit
bccd4129
authored
1 year ago
by
Philippe Dosch
Browse files
Options
Downloads
Patches
Plain Diff
scissors et snip-lines-mail définis
parent
6fb061df
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.emacs
+37
-0
37 additions, 0 deletions
.emacs
with
37 additions
and
0 deletions
.emacs
+
37
−
0
View file @
bccd4129
...
...
@@ -1074,6 +1074,43 @@
;; le code décimal)
(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 s") '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 l") 'snip-lines-mail)
;;; .emacs ends here
(provide '.emacs)
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