Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
856b2f11
Commit
856b2f11
authored
Jul 08, 2011
by
Stefan Monnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/abbrev.el (expand-abbrev): Try to preserve point.
Fixes: debbugs:5805
parent
afae1d68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
lisp/ChangeLog
lisp/ChangeLog
+4
-0
lisp/abbrev.el
lisp/abbrev.el
+22
-13
No files found.
lisp/ChangeLog
View file @
856b2f11
2011-07-08 Stefan Monnier <monnier@iro.umontreal.ca>
* abbrev.el (expand-abbrev): Try to preserve point (bug#5805).
2011-07-08 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-sh.el (tramp-sh-handle-start-file-process): Use a
...
...
lisp/abbrev.el
View file @
856b2f11
...
...
@@ -814,19 +814,28 @@ Returns the abbrev symbol, if expansion took place."
(
destructuring-bind
(
&optional
sym
name
wordstart
wordend
)
(
abbrev--before-point
)
(
when
sym
(
unless
(
or
;; executing-kbd-macro
noninteractive
(
window-minibuffer-p
(
selected-window
)))
;; Add an undo boundary, in case we are doing this for
;; a self-inserting command which has avoided making one so far.
(
undo-boundary
))
;; Now sym is the abbrev symbol.
(
setq
last-abbrev-text
name
)
(
setq
last-abbrev
sym
)
(
setq
last-abbrev-location
wordstart
)
;; If this abbrev has an expansion, delete the abbrev
;; and insert the expansion.
(
abbrev-insert
sym
name
wordstart
wordend
)))))
(
let
((
startpos
(
copy-marker
(
point
)
t
))
(
endmark
(
copy-marker
wordend
t
)))
(
unless
(
or
;; executing-kbd-macro
noninteractive
(
window-minibuffer-p
(
selected-window
)))
;; Add an undo boundary, in case we are doing this for
;; a self-inserting command which has avoided making one so far.
(
undo-boundary
))
;; Now sym is the abbrev symbol.
(
setq
last-abbrev-text
name
)
(
setq
last-abbrev
sym
)
(
setq
last-abbrev-location
wordstart
)
;; If this abbrev has an expansion, delete the abbrev
;; and insert the expansion.
(
prog1
(
abbrev-insert
sym
name
wordstart
wordend
)
;; Yuck!! If expand-abbrev is called with point slightly
;; further than the end of the abbrev, move point back to
;; where it started.
(
if
(
and
(
>
startpos
endmark
)
(
=
(
point
)
endmark
))
;Obey skeletons that move point.
(
goto-char
startpos
))))))))
(
defun
unexpand-abbrev
()
"Undo the expansion of the last abbrev that expanded.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment