unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
Subject: a simple convenience function
Date: Sun, 14 Nov 2004 23:36:00 +0200	[thread overview]
Message-ID: <200411142336.00131.pogonyshev@gmx.net> (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.")

             reply	other threads:[~2004-11-14 21:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-14 21:36 Paul Pogonyshev [this message]
2004-11-14 23:34 ` a simple convenience function 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200411142336.00131.pogonyshev@gmx.net \
    --to=pogonyshev@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).