all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs lisp question
@ 2016-04-18 14:27 Matthias Pfeifer
  2016-04-18 19:50 ` tomas
  2016-04-19 11:59 ` Alexis
  0 siblings, 2 replies; 24+ messages in thread
From: Matthias Pfeifer @ 2016-04-18 14:27 UTC (permalink / raw)
  To: help-gnu-emacs

Hi there,

My emacs version is 25.0.91.1 and it's running on Windows 7. I have this
piece of Emacs lisp that does insert a template file in a fresh java-mode
buffer and start my "pre-processor"


(add-to-list 'auto-insert-alist '(".*\\.java$" . [ "template.java"
mp:java-preprocessor] ))

pre-processor looks like this:

(defun mp:java-preprocessor()
  (let ((classname (file-name-sans-extension (buffer-name)))
    (packagename (mp:predict-package-name-for-current-buffer)))
    (while (search-forward "CLASSNAME" nil t)
      (replace-match classname))
    (goto-char (point-min))
    (while (search-forward "PACKAGE" nil t)
      (replace-match packagename) ) ) )

(defun mp:predict-package-name-for-current-buffer ()
  "Simply take two parent directories and concat with . inbetween."
  (let* ((components (remq ""
               (reverse
                (split-string
                 (file-name-directory (buffer-file-name))
                 "\\/")))))
    (concat (nth 0 components) "." (nth 1 components) "." (nth 2
components))))


The problem is that the class-name and package-name are actually inserted
in capital letters while all file-names involved are writtn with lower-case
letters. So for a file with this path "c:/a/b/c/d/. The predict method
actually inserts: C.D.

Calling it outside the auto-insert environment eg by pressing C-x C-e
behind the closing paren belonging to the form in the
mp:predict-package-name-for-current-buffer function results into a lower
case letters package name.

Sorry for the bit lengthy question. I hope the question is clear: Why is
the result in capital letters in one case and in the case of the filename
letters in the other case?

Matthias


^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <mailman.616.1460989677.7477.help-gnu-emacs@gnu.org>]
[parent not found: <mailman.2559.1372339138.22516.help-gnu-emacs@gnu.org>]
* Emacs Lisp Question
@ 2013-06-27 13:11 drain
  2013-06-27 13:25 ` Thorsten Jolitz
  0 siblings, 1 reply; 24+ messages in thread
From: drain @ 2013-06-27 13:11 UTC (permalink / raw)
  To: Help-gnu-emacs

(defun copy-region-as-kill (beg end)
  "Save the region as if killed, but don't kill it.
     In Transient Mark mode, deactivate the mark.
     If `interprogram-cut-function' is non-nil, also save the text for a
window
     system cut and paste."
  (interactive "r")
  (if (eq last-command 'kill-region)
      (kill-append (filter-buffer-substring beg end) (< end beg))
    (kill-new (filter-buffer-substring beg end)))
  (if transient-mark-mode
      (setq deactivate-mark t))
  nil)

What is the "nil" doing at the end here? The syntax seems to be:

(defun copy-region-as-kill (beg end) [...] nil)



--
View this message in context: http://emacs.1067599.n5.nabble.com/Emacs-Lisp-Question-tp290340.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 24+ messages in thread
* Emacs lisp question
@ 2011-02-06 23:19 Ben
  2011-02-07  1:38 ` Barry Margolin
  0 siblings, 1 reply; 24+ messages in thread
From: Ben @ 2011-02-06 23:19 UTC (permalink / raw)
  To: help-gnu-emacs

I have a small ELlisp package that configures Emacs to use a vertical
bar caret.  It takes into account the differences between GNU Emacs
and XEmacs.

In this package I have the following line.

(setq-default cursor-type '(bar . bk-preferred-caret-width))

bk-preferred-caret-width is a defcustom variable with a default value
of 2.

Unfortunately this does not have the desired effect.  However, the
following does work.

(setq-default cursor-type '(bar . 2))

Can anyone suggest how I might get this to work?

Thanks.


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Emacs lisp question
@ 2011-02-06 23:04 Ben Key
  2011-02-07  0:49 ` Perry Smith
  2011-02-07  1:05 ` Drew Adams
  0 siblings, 2 replies; 24+ messages in thread
From: Ben Key @ 2011-02-06 23:04 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

I have a small ELlisp package that configures Emacs to use a vertical bar
caret.  It takes into account the differences between GNU Emacs and XEmacs.

In this package I have the following line.

(setq-default cursor-type '(bar . bk-preferred-caret-width))

bk-preferred-caret-width is a defcustom variable with a default value of 2.

Unfortunately this does not have the desired effect.  However, the following
does work.

(setq-default cursor-type '(bar . 2))

Can anyone suggest how I might get this to work?

Thanks.

[-- Attachment #2: Type: text/html, Size: 653 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: Emacs & Lisp question
@ 2009-06-27 13:08 Ben Badgley
  0 siblings, 0 replies; 24+ messages in thread
From: Ben Badgley @ 2009-06-27 13:08 UTC (permalink / raw)
  To: help-gnu-emacs



Richard Riley:

"at about 80 euro for a terabyte of hard drive, I wonder if its
a good investment of anyone times and effort at this stage"


Fair enough, though some of us are indeed poor working class sods
that can not dole out about $160 USD just for giggles. :-) I have
a 160 Gig hard drive for the *nix system. I would love to slap a
new terabyte drive on board.

That is a modest drive for me. Had not expected to fill it up so 
quickly, Emacs and Lisp  in general have corrupted me. I'm gathering 
docs, libraries, hack tips, bit and bobbles like the hatter. That 
requires this odd thing called space.

And I actually had only ordered an 80 Gig. Not complaining, merely
saying. Guess the hardware vendor was thinking ahead for me. It worked
out to the same price.

At present, still awaiting this Change thing. Finding good steady
employ limits the wont. So, got to wait on getting the terabyte drive.



Tim X:

  "As far as I know, emacs can handle gzipped *.el files, but the
*.elc files cannot be compressed. "


Okay, gotcha. That means emacs is capable of x, not y. Which is good
to know before going out on a limb with crofting.

"On one hand, you reduce storage
space. However, on the other, the files genraly must be uncompressed
before the application can interpret the code. This can cause overhead
that may slow down an applications execution."

Alright, this is in general, as far as any application or program, or 
just emacs?

Apologies if it appears I'm being ignorant on this point. I am really 
genuinely curious and feel compelled to know specifics. If emacs needs 
to uncompress, okay no problem. If however it applies all the across the 
board, then I may not be able to implement as desired, or else find a 
way. So, this is really a learning quest, being new to emacs and Lisp in
general.

"The other issue to consider and for which I have no data is to what
extent the data is able to be compressed."

Well, from my limited point of view and reading of docs, text seems to 
compress quite well. And Lisp libraries are in fact text. That was 
something which prompted my thought of compressing them for use with 
emacs, and then led to the next thought, "hey why not do that for all 
Lisp code?"

Then again, I'm just a silly country boy coming unto all of this with 
fresh eyes. My views may be skewed and or incorrect. Please do tell me.
You don't learn by spewing sewage.

"profiel of the system your
running on. If you have a system with very fast CPU and restricted
storage, compression may be beneficial. However, if you have slower CPUs
or large amounts of available storage with good disk IO etc, compression
may not actually be of any real benefit - maybe even a negative benefit.
"

Yep. There are lots of variables to consider in this. I did not say 
there wasn't. I could suggest programmers do as programmers oft do, 
classify the variables. Create a common object such as computer type. 
Hm, but then that really installs Insanity version 0.01, doesn't it? :-)

Excuse me, off now to mow the lawn. Run it slow.

---
Ben




^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <mailman.1371.1246077688.2239.help-gnu-emacs@gnu.org>]
* Emacs & Lisp question
@ 2009-06-26 23:05 Ben Badgley
  2009-06-27 17:40 ` Johan Bockgård
  0 siblings, 1 reply; 24+ messages in thread
From: Ben Badgley @ 2009-06-26 23:05 UTC (permalink / raw)
  To: help-gnu-emacs


Been using Google all day to no avail. I think it is pretty straight 
forward question.

Can you use compressed Lisp code? Will it evaluate, compile and evaluate?

The reason I ask is due to looking at the Emacs directory. The Lisp code 
directory sure does eat up a lot of space. So, it came to mind, "why not 
compress each of those buggers and let the interpreter use them from the 
archives?"

Will Emacs allow this? Further is it even doable beyond Emacs?

This may not be exactly the best place for me to ask, understood. I am 
trying to keep it related to Emacs on a general usage level. If we can 
use compressed libraries, wouldn't it be worth knowing? ;-)


---
Ben




^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <mailman.303.1073667340.928.help-gnu-emacs@gnu.org>]
* Emacs Lisp question
@ 2004-01-09 15:55 Gian Uberto Lauri
  0 siblings, 0 replies; 24+ messages in thread
From: Gian Uberto Lauri @ 2004-01-09 15:55 UTC (permalink / raw)


Could someone give me an explaination  of the meaning of the third and
fourth parameter of (put-text-property) ?

What  does it  means  using the  current  syntax table  for the  third
argument and a single number list for the fourth ?

Thanks in advance!

 /\            ___
/___/\__|_|\_|__|___Gian Uberto Lauri_____________________
  //--\ | | \|  |   Integralista GNUslamico e fancazzista 
\/

^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <mailman.669.1061546874.29551.help-gnu-emacs@gnu.org>]
* Emacs LISP Question
@ 2003-08-20 16:04 Yakov Nekritch
  0 siblings, 0 replies; 24+ messages in thread
From: Yakov Nekritch @ 2003-08-20 16:04 UTC (permalink / raw)


Hello,

I have the following emacs lisp question. 
How can I implement a  mouse pop-up menu, for a menu defined with 
easy-menu-define?

I was thinking about something like this:


(require 'xcscope )

(defun mouse-popup-cscopemenu ( )
 "Popup a cscope menu."
 (popup-menu  cscope:menu ) )


(define-key c-mode-base-map [S-down-mouse-3]  'mouse-popup-cscopemenu)


And  cscope:menu is defined in  xcscope.el .


However this does not work. When I press Shift-RightMouse I get:

Wrong type argument: commandp, mouse-popup-cscopemenu



Can anybody tell me what is wrong with my approach and how this function should 
be realised?
Any help will be appreciated.


Regards,
Yakov


==========================================================================
Dr. Yakov Nekrich		Phone:  +49-(0)228-734209
Computer Science Department	Fax:    +49-(0)228-734440
University of Bonn		e-mail: yasha@cs.uni-bonn.de
Römerstrasse 164,		http://theory.cs.uni-bonn.de/~yasha
53117 Bonn
Germany
==========================================================================

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

end of thread, other threads:[~2016-04-22  9:05 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 14:27 Emacs lisp question Matthias Pfeifer
2016-04-18 19:50 ` tomas
2016-04-19 10:39   ` Matthias Pfeifer
2016-04-19 11:59 ` Alexis
2016-04-22  9:05   ` Matthias Pfeifer
     [not found] <mailman.616.1460989677.7477.help-gnu-emacs@gnu.org>
2016-04-18 16:05 ` Barry Margolin
     [not found] <mailman.2559.1372339138.22516.help-gnu-emacs@gnu.org>
2013-06-27 15:33 ` Emacs Lisp Question Barry Margolin
  -- strict thread matches above, loose matches on Subject: below --
2013-06-27 13:11 drain
2013-06-27 13:25 ` Thorsten Jolitz
2011-02-06 23:19 Emacs lisp question Ben
2011-02-07  1:38 ` Barry Margolin
2011-02-06 23:04 Ben Key
2011-02-07  0:49 ` Perry Smith
2011-02-07  1:05 ` Drew Adams
2011-02-07  1:30   ` Ben Key
2009-06-27 13:08 Emacs & Lisp question Ben Badgley
     [not found] <mailman.1371.1246077688.2239.help-gnu-emacs@gnu.org>
2009-06-27  5:52 ` Tim X
2009-06-27 10:19 ` Richard Riley
2009-06-26 23:05 Ben Badgley
2009-06-27 17:40 ` Johan Bockgård
     [not found] <mailman.303.1073667340.928.help-gnu-emacs@gnu.org>
2004-01-09 16:48 ` Emacs " Paolo Gianrossi
2004-01-09 15:55 Gian Uberto Lauri
     [not found] <mailman.669.1061546874.29551.help-gnu-emacs@gnu.org>
2003-08-22 11:17 ` Emacs LISP Question Klaus Zeitler
2003-08-20 16:04 Yakov Nekritch

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.