unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* a simple convenience function
@ 2004-11-14 21:36 Paul Pogonyshev
  2004-11-14 23:34 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Paul Pogonyshev @ 2004-11-14 21:36 UTC (permalink / raw)


I'm not sure this issue wasn't raised already, but what do
you think about adding this simple function to Emasc?  It
could just sit there for optional binding through `~/.emacs'
by those who like this behaviour.  Or we could make behaviour
of the Home key customizeable.

Quick explanation: in the line

	  some t[>>point<<]ext here

after first evaluation of proposed function we get

	  [>>point<<]some text here

and after second evaluation we get

[>>point<<]	  some text here


Paul


--- indent.el	24 Oct 2004 23:58:43 +0300	1.59
+++ indent.el	14 Nov 2004 23:28:35 +0200	
@@ -329,6 +329,21 @@ line, but does not move past any whitesp
   (if (memq (current-justification) '(center right))
       (skip-chars-forward " \t")))
 
+(defun beginning-of-line-smart (&optional n)
+  "Move to the beginning of the text on this line, or to the beginning of the line.
+More exactly, if the point is already at the beginning of the
+line's text (as defined by `beginning-of-line-text'), it is
+placed at the very beginning of the line.  Otherwise it is moved
+to the text beginning.
+
+With optional argument, different from 1, behave identically to
+`beginning-of-line-text'."
+  (interactive "p")
+  (let ((current-point (point)))
+    (beginning-of-line-text n)
+    (when (= (point) current-point)
+      (beginning-of-line))))
+
 (defvar indent-region-function nil
   "Short cut function to indent region using `indent-according-to-mode'.
 A value of nil means really run `indent-according-to-mode' on each line.")

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-11-16 17:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-14 21:36 a simple convenience function Paul Pogonyshev
2004-11-14 23:34 ` Miles Bader
2004-11-15  0:22   ` Lennart Borgman
2004-11-15  1:49     ` Paul Pogonyshev
2004-11-15  5:01       ` Dhruva Krishnamurthy
2004-11-15  7:28       ` Lennart Borgman
2004-11-15  1:50   ` Paul Pogonyshev
2004-11-15  6:45 ` Thien-Thi Nguyen
2004-11-15  9:29 ` Kai Grossjohann
2004-11-15 23:14   ` Alex Schroeder
2004-11-15 23:27     ` Lennart Borgman
2004-11-16 17:11     ` Kai Grossjohann
2004-11-16 17:14     ` Kai Grossjohann
2004-11-16 17:20     ` Kai Grossjohann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).