all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About Emacs features
@ 2014-01-13 19:27 Alejandro Zamora Fonseca
  2014-01-15  2:41 ` Sivaram Neelakantan
  2014-01-27 20:23 ` Ken Goldman
  0 siblings, 2 replies; 9+ messages in thread
From: Alejandro Zamora Fonseca @ 2014-01-13 19:27 UTC (permalink / raw)
  To: help-gnu-emacs

Hello!
I´m a Emacs new user and I have a question.
How I can auto-complete words and create 'macros'(code snipets rapid 
generation) like in Notepad++.?

Thanks,
Alejandro


--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/




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

* Re: About Emacs features
       [not found] <mailman.11821.1389641073.10748.help-gnu-emacs@gnu.org>
@ 2014-01-13 19:30 ` Emanuel Berg
  2014-01-13 21:40 ` Emanuel Berg
  2014-01-16 13:32 ` Javier
  2 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2014-01-13 19:30 UTC (permalink / raw)
  To: help-gnu-emacs

Alejandro Zamora Fonseca <terefv@ltu.sld.cu> writes:

> Hello!  I´m a Emacs new user and I have a question.
> How I can auto-complete words and create
> 'macros'(code snipets rapid generation) like in
> Notepad++.?

There are probably many modules for this. 'yasnippet',
for example. Lots of times, though, it is better just
to work on your typing. For really long and annoying
words, you can setup abbrevs.

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

* Re: About Emacs features
       [not found] <mailman.11821.1389641073.10748.help-gnu-emacs@gnu.org>
  2014-01-13 19:30 ` Emanuel Berg
@ 2014-01-13 21:40 ` Emanuel Berg
  2014-01-13 21:54   ` Damien Wyart
  2014-01-16 13:32 ` Javier
  2 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2014-01-13 21:40 UTC (permalink / raw)
  To: help-gnu-emacs

Alejandro Zamora Fonseca <terefv@ltu.sld.cu> writes:

> Hello! I'm a Emacs new user and I have a question.
> How I can auto-complete words and create 'macros'
> (code snipets rapid generation) like in Notepad++?

For "auto-complete", you can use abbrev, as mentioned,
but I don't know if there is a "dynamic" auto-complete
feature like in some of those M$ IDEs where you define
a variable (or create a button, with old-school
Hungarian notation to keep track of one zillion
objects) and then just type the beginning of the name
to get suggestions, and then hit enter to complete. I
don't like that, because it is disruptive, and besides
short names and typing (finger habits/muscle memory)
will more than account for it (as I see it), but if you
want it, I never saw any abbrev except for the static
one that you manually put up in a file (or with
interactive calls). Most likely, someone else on this
list can tell you if such a feature exists.

As for keyboard macros, there are those (not to be
confused with Lisp macros), as in poor man's
programming (like xmacroplay in X) but as you describe
it, I'd say you don't want (keyboard) macros, but a
template facility. Check out those URLs:

http://www.emacswiki.org/emacs/CategoryTemplates
http://unix.stackexchange.com/a/71623

As an example, this is what aptitude tells me about
'yasnippet':

Description: A template system for Emacs

YASnippet (yet another snippet extension for Emacs) is
a template system for Emacs. It allows you to type an
abbreviation and automatically expand the abbreviation
into function templates.
 
Bundled language templates includes: C, C++, C#, Perl,
Python, Ruby, SQL, LaTeX, HTML, CSS and more.

Homepage: http://code.google.com/p/yasnippet/

-- 
underground experts united:
http://user.it.uu.se/~embe8573


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

* Re: About Emacs features
  2014-01-13 21:40 ` Emanuel Berg
@ 2014-01-13 21:54   ` Damien Wyart
  2014-01-13 21:59     ` Damien Wyart
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Wyart @ 2014-01-13 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

* Emanuel Berg <embe8573@student.uu.se> in gnu.emacs.help:
> For "auto-complete", you can use abbrev, as mentioned, but I don't
> know if there is a "dynamic" auto-complete feature like in some of
> those M$ IDEs where you define a variable (or create a button, with
> old-school Hungarian notation to keep track of one zillion objects)
> and then just type the beginning of the name to get suggestions, and
> then hit enter to complete.

Auto Complete is quite popular: http://cx4a.org/software/auto-complete/

Other packages are listed here (under Text Completion):
http://www.emacswiki.org/emacs/CategoryCompletion

There are also a few per-language specialized packages, eg Jedi for
Python: http://tkf.github.io/emacs-jedi/
or Robe or Rsense for Ruby, and so on...

-- 
DW


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

* Re: About Emacs features
  2014-01-13 21:54   ` Damien Wyart
@ 2014-01-13 21:59     ` Damien Wyart
  0 siblings, 0 replies; 9+ messages in thread
From: Damien Wyart @ 2014-01-13 21:59 UTC (permalink / raw)
  To: help-gnu-emacs

> Auto Complete is quite popular: http://cx4a.org/software/auto-complete/

https://github.com/company-mode/company-mode is also quite good.

-- 
DW


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

* Re: About Emacs features
  2014-01-13 19:27 About Emacs features Alejandro Zamora Fonseca
@ 2014-01-15  2:41 ` Sivaram Neelakantan
  2014-01-27 20:23 ` Ken Goldman
  1 sibling, 0 replies; 9+ messages in thread
From: Sivaram Neelakantan @ 2014-01-15  2:41 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, Jan 14 2014,Alejandro Zamora Fonseca Alejandro Zamora Fonseca wrote:

> Hello!
> I´m a Emacs new user and I have a question.
> How I can auto-complete words and create 'macros'(code snipets rapid
> generation) like in Notepad++.?
>
> Thanks,
> Alejandro
>
>

try auto-complete which might be a bit more natural.  And I got this
snippet from the list here a long time ago.  TAB does some completions 

--8<---------------cut here---------------start------------->8---
;;;;re-using tab 
(defun indent-or-expand (arg) 
  "Either indent according to mode, or expand the word preceding 
point." 
  (interactive "*P") 
  (if (and 
       (or (bobp) (= ?w (char-syntax (char-before)))) 
       (or (eobp) (not (= ?w (char-syntax (char-after)))))) 
      (dabbrev-expand arg) 
    (indent-according-to-mode))) 
 
(defun my-tab-fix () 
  (local-set-key [tab] 'indent-or-expand)) 

(add-hook 'c-mode-hook          'my-tab-fix) 
(add-hook 'sh-mode-hook         'my-tab-fix) 
(add-hook 'text-mode-hook         'my-tab-fix) 
(add-hook 'emacs-lisp-mode-hook 'my-tab-fix) 
--8<---------------cut here---------------end--------------->8---


[snipped 8 lines]



 sivaram
 -- 




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

* Re: About Emacs features
       [not found] <mailman.11821.1389641073.10748.help-gnu-emacs@gnu.org>
  2014-01-13 19:30 ` Emanuel Berg
  2014-01-13 21:40 ` Emanuel Berg
@ 2014-01-16 13:32 ` Javier
  2 siblings, 0 replies; 9+ messages in thread
From: Javier @ 2014-01-16 13:32 UTC (permalink / raw)
  To: help-gnu-emacs

To most straighforward way to complete a word is M-/ (ESC-/).  It just
guesses from the words you previously typed.  Press M-/ again to
change the choices for the word.  It should work in recent versions of
emacs without configuring anything.

M-/ (translated from <escape> /) runs the command dabbrev-expand,
which is an interactive autoloaded Lisp function in `dabbrev.el'.

It is bound to M-/.

------------------------------------------------------------
(dabbrev-expand ARG)

Expand previous word "dynamically".

Expands to the most recent, preceding word for which this is a prefix.
If no suitable preceding word is found, words following point are
considered.  If still no suitable word is found, then look in the
buffers accepted by the function pointed out by variable
`dabbrev-friend-buffer-function'.

A positive prefix argument, N, says to take the Nth backward *distinct*
possibility.  A negative argument says search forward.

If the cursor has not moved from the end of the previous expansion and
no argument is given, replace the previously-made expansion
with the next possible expansion not yet tried.

The variable `dabbrev-backward-only' may be used to limit the
direction of search to backward if set non-nil.

See also `dabbrev-abbrev-char-regexp' and C-M-/.



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

* Re: About Emacs features
  2014-01-13 19:27 About Emacs features Alejandro Zamora Fonseca
  2014-01-15  2:41 ` Sivaram Neelakantan
@ 2014-01-27 20:23 ` Ken Goldman
  2014-01-29  2:39   ` Pete Ley
  1 sibling, 1 reply; 9+ messages in thread
From: Ken Goldman @ 2014-01-27 20:23 UTC (permalink / raw)
  To: help-gnu-emacs

On 1/13/2014 2:27 PM, Alejandro Zamora Fonseca wrote:

> How I can auto-complete words

Start with this:

M-/ runs the command dabbrev-expand

> and create 'macros'(code snipets rapid generation) like in Notepad++.?

The easiest way to start is with keyboard macros.  You don't have to 
write any code.  It's like a key logger and replay.

To define

start-kbd-macro
end-kbd-macro

To run

call-last-kbd-macro

To save

name-kbd-macro







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

* Re: About Emacs features
  2014-01-27 20:23 ` Ken Goldman
@ 2014-01-29  2:39   ` Pete Ley
  0 siblings, 0 replies; 9+ messages in thread
From: Pete Ley @ 2014-01-29  2:39 UTC (permalink / raw)
  To: Ken Goldman; +Cc: help-gnu-emacs

Ken Goldman <kgoldman@us.ibm.com> writes:

> To define
>
> start-kbd-macro
> end-kbd-macro
>
> To run
>
> call-last-kbd-macro
>
> To save
>
> name-kbd-macro

You can also open up your init file and run insert-kbd-macro so it's
saved between sessions. 



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

end of thread, other threads:[~2014-01-29  2:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 19:27 About Emacs features Alejandro Zamora Fonseca
2014-01-15  2:41 ` Sivaram Neelakantan
2014-01-27 20:23 ` Ken Goldman
2014-01-29  2:39   ` Pete Ley
     [not found] <mailman.11821.1389641073.10748.help-gnu-emacs@gnu.org>
2014-01-13 19:30 ` Emanuel Berg
2014-01-13 21:40 ` Emanuel Berg
2014-01-13 21:54   ` Damien Wyart
2014-01-13 21:59     ` Damien Wyart
2014-01-16 13:32 ` Javier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.