RE: Repair to access checking in Win32
17 years, 12 months
Benson Margulies
Hi.
1) I'll be happy to use your patcher procedure from here on out. Perhaps
the web page could include the details below? (It doesn't seem to have
been updated since 2002.) Attachment versus inline: I just wasn't sure
which way you all sent patches around. Do you need a ChangeLog entry
now, or can you derive one from my in-line comments?
2) I can look into cygwin. Is there a specific bug report of cygwin
misbehavior? Or is it the same situation: miscellaneous attributes
confuse the check?
--benson
-----Original Message-----
From: ethersoft(a)gmail.com [mailto:ethersoft@gmail.com] On Behalf Of Vin
Shelton
Sent: Sunday, November 19, 2006 1:47 PM
To: Benson Margulies
Cc: xemacs-patches(a)xemacs.org
Subject: Re: Repair to access checking in Win32
Benson,
Thank you very much for this patch:
On 11/18/06, Benson Margulies <bim2006(a)basistech.com> wrote:
> Index: fileio.c
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
> retrieving revision 1.66.2.7
> diff -u -r1.66.2.7 fileio.c
> --- fileio.c 2005/01/31 02:55:14 1.66.2.7
> +++ fileio.c 2006/11/18 21:12:37
I applied the patch you submitted to xemacs-beta; that seems to do the
job for WIN32_NATIVE! This is a big improvement; I always wondered
why I would occasionally get the one-off "File not found and directory
write-protected message". Thanks for addressing this!
Here are my comments:
In general, many of us find the 'patcher' package a very easy way to
submit XEmacs packages. In particular, patcher takes care of:
1. Please include a ChangeLog entry for your submissions.
2. Attaching your diff keeps various mailers from munging the message
contents and greatly increases the chance that the patch will arrive
intact.
In specific - not being the kind to look a gift horse in the mouth -
it would be very useful to extend the patch so that it worked under
Cygwin, too. Do you think you could manage that?
Thank you,
Vin Shelton
--
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Repair to access checking in Win32
17 years, 12 months
Benson Margulies
Index: fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.66.2.7
diff -u -r1.66.2.7 fileio.c
--- fileio.c 2005/01/31 02:55:14 1.66.2.7
+++ fileio.c 2006/11/18 21:12:37
@@ -57,6 +57,7 @@
#define WIN32_FILENAMES
#ifdef WIN32_NATIVE
#include "nt.h"
+#include <aclapi.h>
#endif /* WIN32_NATIVE */
#define IS_DRIVE(x) isalpha (x)
/* Need to lower-case the drive letter, or else expanded
@@ -2272,6 +2273,66 @@
static int
check_writable (const char *filename)
{
+#ifdef WIN32_NATIVE
+ // Since this has to work for a directory, we can't just call
'CreateFile'
+ PSECURITY_DESCRIPTOR pDesc; /* Must be freed with LocalFree */
+ /* these need not be freed, they point into pDesc */
+ PSID psidOwner;
+ PSID psidGroup;
+ PACL pDacl;
+ PACL pSacl;
+ /* end of insides of descriptor */
+ DWORD error;
+ DWORD attributes;
+ HANDLE tokenHandle;
+ GENERIC_MAPPING genericMapping;
+ DWORD accessMask;
+ PRIVILEGE_SET PrivilegeSet;
+ DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET );
+ BOOL fAccessGranted = FALSE;
+ DWORD dwAccessAllowed;
+
+ /* Win32 prototype lacks const. */
+ error = GetNamedSecurityInfo((LPTSTR)filename, SE_FILE_OBJECT,
+
DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFO
RMATION,
+ &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
+ if(error != ERROR_SUCCESS) { // FAT?
+ attributes = GetFileAttributes(filename);
+ return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 ==
(attributes & FILE_ATTRIBUTE_READONLY));
+ }
+
+ genericMapping.GenericRead = FILE_GENERIC_READ;
+ genericMapping.GenericWrite = FILE_GENERIC_WRITE;
+ genericMapping.GenericExecute = FILE_GENERIC_EXECUTE;
+ genericMapping.GenericAll = FILE_ALL_ACCESS;
+
+ if(!ImpersonateSelf(SecurityDelegation)) {
+ return 0;
+ }
+ if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE,
&tokenHandle)) {
+ return 0;
+ }
+
+ accessMask = GENERIC_WRITE;
+ MapGenericMask(&accessMask, &genericMapping);
+
+ if(!AccessCheck(pDesc, tokenHandle, accessMask, &genericMapping,
+ &PrivilegeSet, // receives
privileges used in check
+ &dwPrivSetSize, // size of
PrivilegeSet buffer
+ &dwAccessAllowed, // receives
mask of allowed access rights
+ &fAccessGranted))
+ {
+ DWORD oops = GetLastError();
+ CloseHandle(tokenHandle);
+ RevertToSelf();
+ LocalFree(pDesc);
+ return 0;
+ }
+ CloseHandle(tokenHandle);
+ RevertToSelf();
+ LocalFree(pDesc);
+ return fAccessGranted == TRUE;
+#else
#ifdef HAVE_EACCESS
return (eaccess (filename, W_OK) >= 0);
#else
@@ -2281,6 +2342,7 @@
Opening with O_WRONLY could work for an ordinary file,
but would lose for directories. */
return (access (filename, W_OK) >= 0);
+#endif
#endif
}
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] rename make-mode-line-mouse-map to avoid confusing gnus
17 years, 12 months
Jeff Miller
I will be committing this shortly.
Mike - Please let me know whether this fixes the problem you saw.
Jeff
ChangeLog addition:
2006-11-18 Jeff Miller <jeff.miller(a)xemacs.org>
* cal-compat.el (make-mode-line-mouse-map): Removed.
* cal-compat.el (cal-make-mode-line-mouse-map): Renamed. Using
the original name caused Gnus to think it was runnng under Emacs
and it attempted to use a face XEmacs does not define.
* calendar.el (calendar-mode-line-format): use the renamed function
calendar source patch:
Diff command: cvs -q diff -uN
Files affected: calendar.el cal-compat.el
Index: cal-compat.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/cal-compat.el,v
retrieving revision 1.1
diff -u -u -r1.1 cal-compat.el
--- cal-compat.el 2006/10/23 01:25:27 1.1
+++ cal-compat.el 2006/11/19 00:18:38
@@ -229,7 +229,7 @@
;; Available in Emacs 22
;;;###autoload
-(defun make-mode-line-mouse-map (mouse function) "\
+(defun cal-make-mode-line-mouse-map (mouse function) "\
Return a keymap with single entry for mouse key MOUSE on the mode line.
MOUSE is defined to run function FUNCTION with no args in the buffer
corresponding to the mode line clicked."
Index: calendar.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/calendar.el,v
retrieving revision 1.12
diff -u -u -r1.12 calendar.el
--- calendar.el 2006/11/13 04:22:12 1.12
+++ calendar.el 2006/11/19 00:18:39
@@ -2359,7 +2359,7 @@
"\\<calendar-mode-map>\\[scroll-calendar-left]")
'help-echo "mouse-2: scroll left"
'mouse-face 'modeline-mousable
- 'keymap (make-mode-line-mouse-map 'button2
+ 'keymap (cal-make-mode-line-mouse-map 'button2
'mouse-scroll-calendar-left))
"Calendar"
(concat
@@ -2368,14 +2368,14 @@
"\\<calendar-mode-map>\\[calendar-goto-info-node] info")
'help-echo "mouse-2: read Info on Calendar"
'mouse-face 'modeline-mousable
- 'keymap (make-mode-line-mouse-map 'button2 'calendar-goto-info-node))
+ 'keymap (cal-make-mode-line-mouse-map 'button2 'calendar-goto-info-node))
"/"
(propertize
(substitute-command-keys
"\\<calendar-mode-map>\\[calendar-other-month] other")
'help-echo "mouse-2: choose another month"
'mouse-face 'modeline-mousable
- 'keymap (make-mode-line-mouse-map
+ 'keymap (cal-make-mode-line-mouse-map
'button2 'mouse-calendar-other-month))
"/"
(propertize
@@ -2383,13 +2383,13 @@
"\\<calendar-mode-map>\\[calendar-goto-today] today")
'help-echo "mouse-2: go to today's date"
'mouse-face 'modeline-mousable
- 'keymap (make-mode-line-mouse-map 'button2 #'calendar-goto-today)))
+ 'keymap (cal-make-mode-line-mouse-map 'button2 #'calendar-goto-today)))
'(calendar-date-string (calendar-current-date) t)
(propertize (substitute-command-keys
"\\<calendar-mode-map>\\[scroll-calendar-right]")
'help-echo "mouse-2: scroll right"
'mouse-face 'modeline-mousable
- 'keymap (make-mode-line-mouse-map
+ 'keymap (cal-make-mode-line-mouse-map
'button2 'mouse-scroll-calendar-right)))
"The mode line of the calendar buffer.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[AC] [PACKAGES (edebug)] Fix for raw strings
17 years, 12 months
Steve Youngs
APPROVE COMMIT
NOTE: This patch has been committed.
edebug patch:
ChangeLog files diff command: cvs -q diff -U 0
Files affected: ChangeLog
Source files diff command: cvs -q diff -uN
Files affected: edebug.el
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/edebug/ChangeLog,v
retrieving revision 1.26
diff -u -p -U0 -r1.26 ChangeLog
--- ChangeLog 5 Jul 2004 06:28:29 -0000 1.26
+++ ChangeLog 18 Nov 2006 22:01:51 -0000
@@ -0,0 +1,5 @@
+2006-11-19 Steve Youngs <steve(a)sxemacs.org>
+
+ * edebug.el (edebug-read-function): Add ?r to make edebug work
+ with SXEmacs raw strings.
+
Index: edebug.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/edebug/edebug.el,v
retrieving revision 1.11
diff -u -p -u -r1.11 edebug.el
--- edebug.el 2 Jul 2004 16:29:38 -0000 1.11
+++ edebug.el 18 Nov 2006 22:01:43 -0000
@@ -912,8 +912,9 @@ It should never be negative. This contr
(if (featurep 'cl) 'function* 'function))
(edebug-read-storing-offsets stream)))
;; XEmacs: Add #* for bit vectors
+ ;; SXEmacs: Add #r for raw strings
((memq (char-after) '(?: ?B ?O ?X ?b ?o ?x ?1 ?2 ?3 ?4 ?5 ?6
- ?7 ?8 ?9 ?0 ?*))
+ ?7 ?8 ?9 ?0 ?* ?r))
(backward-char 1)
(edebug-original-read stream))
(t (edebug-syntax-error "Bad char after #"))))
--
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
| SXEmacs - The only _______ you'll ever need. |
| Fill in the blank, yes, it's THAT good! |
|------------------------------------<steve(a)sxemacs.org>---|
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Make locate startup files work in 21.5
17 years, 12 months
Malcolm Purvis
This is the second of my locale specific patches. The locale package provides
for custom startup screens. In 21.4 they are fetched by $LANG (eg 'fr') but
for 21.5 they are accessed via current-language-environment (eg 'French').
This patch installed these files in two directories so that they can be found
by 21.5 and 21.4. I thought about using a symlink to alias the directory but
that wouldn't work under Windows.
mule-packages/locale/ChangeLog addition:
2006-10-22 Malcolm Purvis <malcolmp(a)xemacs.org>
* Makefile: Store files in two subdirectories so that they can be
found by 21.5 and 21.4.
xemacs-packages source patch:
Diff command: cvs -q diff -u
Files affected: mule-packages/locale/Makefile
Index: mule-packages/locale/Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/mule-packages/locale/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- mule-packages/locale/Makefile 2004/12/07 22:15:28 1.32
+++ mule-packages/locale/Makefile 2006/10/22 12:18:25
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.22
+VERSION = 1.23
AUTHOR_VERSION =
MAINTAINER = XEmacs Development Team <xemacs-beta(a)xemacs.org>
PACKAGE = locale
@@ -39,6 +39,14 @@
DATA_5_DEST = start-files/ro
DATA_6_FILES = start-files/fr/locale-start.el start-files/fr/locale-start.elc
DATA_6_DEST = start-files/fr
+# 21.5 references these files via current-language-environment rather than
+# $LANG so for compatibility we'll store them in both places.
+DATA_7_FILES = $(DATA_4_FILES)
+DATA_7_DEST = start-files/Japanese
+DATA_8_FILES = $(DATA_5_FILES)
+DATA_8_DEST = start-files/Romanian
+DATA_9_FILES = $(DATA_6_FILES)
+DATA_9_DEST = start-files/French
LOCALE_ELCS = start-files/ja/locale-start.elc start-files/ro/locale-start.elc \
start-files/fr/locale-start.elc
--
Malcolm Purvis <malcolmp(a)xemacs.org>
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[S] [PATCH] Autoconf 2.60 support.
17 years, 12 months
Malcolm Purvis
SUPERSEDES <87zmewde3e.fsf_-_(a)tleepslib.sk.tsukuba.ac.jp>
Another missed patch from a few months ago. This one fixes problems with
autoconf 2.60.
Malcolm
ChangeLog addition:
2006-10-30 Malcolm Purvis <malcolmp(a)xemacs.org>
* configure.ac (XE_CDR): m4_cdr differs in autoconf 2.59 and 2.60.
(XE_EXPAND_COMPLEX_OPTIONS): Use XE_CDR, not m4_cdr.
xemacs-autoconf-2.60 source patch:
Diff command: cvs -q diff -u
Files affected: configure.ac
Index: configure.ac
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/configure.ac,v
retrieving revision 1.47
diff -u -r1.47 configure.ac
--- configure.ac 2006/07/19 19:35:25 1.47
+++ configure.ac 2006/10/30 11:54:13
@@ -22,8 +22,6 @@
dnl Due to a dependence on the implementation of certain internal autoconf
dnl macros, die if any version other than 2.59 is used.
AC_PREREQ(2.59)dnl
-m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [2.59]), 1,
- [m4_fatal([This script can only be generated with autoconf 2.59])], [])dnl
AC_INIT([XEmacs],[21.5],[xemacs-beta(a)xemacs.org])dnl
AC_CONFIG_SRCDIR(src/lisp.h)dnl
dnl
@@ -231,6 +229,13 @@
for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
$1="$T"
])dnl XE_SPACE
+dnl Autoconf 2.59 and 2.60 have slightly different versions of m4_cdr that
+dnl return different values for an empty list. XE_CDR is a copy of the 2.60
+dnl version which will be used with both versions.
+define([XE_CDR],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])dnl
dnl
dnl XE_MERGED_ARG(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl ------------------------------------------------------------------------
@@ -379,9 +384,9 @@
dnl Internal macro to recursively expand all the options in the option list.
dnl
define([XE_EXPAND_COMPLEX_OPTIONS],
-[m4_if([$2], [[]], [],
+[m4_if([$2], [], [],
[XE_EXPAND_COMPLEX_OPTION([$1], m4_fst($2))[]dnl
-XE_EXPAND_COMPLEX_OPTIONS([$1], m4_cdr($2))])])dnl
+XE_EXPAND_COMPLEX_OPTIONS([$1], XE_CDR($2))])])dnl
dnl
dnl XE_INIT_COMPLEX_OPTION(prefix, option_list)
dnl -------------------------------------------
--
Malcolm Purvis <malcolmp(a)xemacs.org>
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Move charsets-in-region to C
17 years, 12 months
Aidan Kehoe
Nothing too complex, and even the fragile test suite passes. Here are some
profiling numbers, where charsets-in-region is the implementation in C and
charsets-in-region0 is the implementation in Lisp:
10,000 calls in *scratch*, vanilla startup
Function Name Ticks/Total %Usage Calls GC-Usage/ Total
===============================/===== ====== ===== ========/=======
charsets-in-region 74/ 88 77.083 10000 99576/ 120000
(profile overhead) 18/ 18 18.750 20424/ 0
charsets-in-region-*-10000 4/ 96 4.167 1 40/ 120040
#<compiled-function (expr &optional arg) "...(36)" [was-profiling arg expr profiling-active-p ((byte-code ¬~Á ~Á~ [was-profiling stop-profiling] 1)) start-profiling eval profile-results clear-profiling-info ((stop-profiling))] 2 (/usr/local/lib/xemacs/xemacs-packages/lisp/xemacs-devel/profile.elc . 9000) (list (read (read-string Expression to profile: )) current-prefix-arg)>
0/ 96 0.000 0/ 120028
Function Name Ticks/Total %Usage Calls GC-Usage/ Total
================================/===== ====== ===== ========/=======
charsets-in-region0 1999/ 2304 89.281 10000 117000/ 120064
(profile overhead) 128/ 128 5.717 3092/ 0
char-charset 110/ 92 4.913 3950000
charsets-in-region0-*-10000 2/ 2306 0.089 1 0/ 120104
#<compiled-function (expr &optional arg) "...(36)" [was-profiling arg expr profiling-active-p ((byte-code ¬~Á ~Á~ [was-profiling stop-profiling] 1)) start-profiling eval profile-results clear-profiling-info ((stop-profiling))] 2 (/usr/local/lib/xemacs/xemacs-packages/lisp/xemacs-devel/profile.elc . 9000) (list (read (read-string Expression to profile: )) current-prefix-arg)>
10,000 calls on HELLO, vanilla startup
Function Name Ticks/Total %Usage Calls GC-Usage/ Total
====================================/===== ====== ===== ========/=======
charsets-in-region 2620/ 3351 80.690 10000 2040000/2040000
(in char-byte conversion) 576/ 514 17.739 11570000
(in garbage collection) 47/ 47 1.447 1
charsets-in-region-*-10000 4/ 3403 0.123 1 24/2040024
#<compiled-function (expr &optional arg) "...(36)" [was-profiling arg expr profiling-active-p ((byte-code ¬Á Á [was-profiling stop-profiling] 1)) start-profiling eval profile-results clear-profiling-info ((stop-profiling))] 2 (/usr/local/lib/xemacs/xemacs-packages/lisp/xemacs-devel/profile.elc . 9000) (list (read (read-string Expression to profile: )) current-prefix-arg)>
(a call with charsets-in-region0 crashed in the profiler)
5,000 calls in HELLO, vanilla startup
Function Name Ticks/Total %Usage Calls GC-Usage/ Total
====================================/===== ====== ===== ========/=======
charsets-in-region 2567/ 3332 79.969 10000 2040000/2040000
(in char-byte conversion) 568/ 479 17.695 11570000
(in garbage collection) 43/ 43 1.340 1
(profile overhead) 28/ 28 0.872
charsets-in-region-*-5000 4/ 3379 0.125 1 64/2040064
Function Name Ticks/Total %Usage Calls GC-Usage/ Total
====================================/===== ====== ===== ========/=======
charsets-in-region0 11693/13187 91.295 10000 2041944/2041944
(in char-byte conversion) 735/ 597 5.739 23450000
char-charset 326/ 246 2.545 11740000
(in garbage collection) 46/ 46 0.359 1
charsets-in-region0-*-5000 8/13195 0.062 1 40/2041984
lisp/ChangeLog addition:
2006-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* mule/mule-charset.el:
* mule/mule-charset.el (charsets-in-string):
Implement it in terms of charsets-in-string.
* mule/mule-charset.el (charsets-in-region): Removed. It's now in
C.
src/ChangeLog addition:
2006-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-charset.c:
* mule-charset.c (Fcharsets_in_region):
Added a charsets-in-region implementation in C.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/text.c
===================================================================
RCS src/mule-charset.c
===================================================================
RCS lisp/mule/mule-charset.el
===================================================================
RCS
Index: lisp/mule/mule-charset.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/mule/mule-charset.el,v
retrieving revision 1.19
diff -u -r1.19 mule-charset.el
--- lisp/mule/mule-charset.el 2006/11/05 22:31:38 1.19
+++ lisp/mule/mule-charset.el 2006/11/14 13:49:48
@@ -38,42 +38,16 @@
;;;; Classifying text according to charsets
-;; the old version was broken in a couple of ways
-;; this is one of several versions, I tried a hash as well as the
-;; `prev-charset' cache used in the old version, but this was definitely
-;; faster than the hash version and marginally faster than the prev-charset
-;; version
-;; #### this really needs to be moved into C
-(defun charsets-in-region (start end &optional buffer)
- "Return a list of the charsets in the region between START and END.
-BUFFER defaults to the current buffer if omitted."
- (let (list)
- (save-excursion
- (if buffer
- (set-buffer buffer))
- (save-restriction
- (narrow-to-region start end)
- (goto-char (point-min))
- (while (not (eobp))
- ;; the first test will usually succeed on testing the
- ;; car of the list; don't waste time let-binding.
- (or (memq (char-charset (char-after (point))) list)
- (setq list (cons (char-charset (char-after (point))) list)))
- (forward-char))))
- list))
-
(defun charsets-in-string (string)
"Return a list of the charsets in STRING."
- (let (list)
- (mapc (lambda (ch)
- ;; the first test will usually succeed on testing the
- ;; car of the list; don't waste time let-binding.
- (or (memq (char-charset ch) list)
- (setq list (cons (char-charset ch) list))))
- string)
- list))
+ (let (res)
+ (with-string-as-buffer-contents string
+ ;; charsets-in-region now in C.
+ (setq res (charsets-in-region (point-min) (point-max))))
+ res))
(defalias 'find-charset-string 'charsets-in-string)
+
(defalias 'find-charset-region 'charsets-in-region)
Index: src/mule-charset.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-charset.c,v
retrieving revision 1.51
diff -u -r1.51 mule-charset.c
--- src/mule-charset.c 2006/11/12 13:40:08 1.51
+++ src/mule-charset.c 2006/11/14 13:49:48
@@ -937,6 +937,39 @@
return Qnil;
}
+DEFUN ("charsets-in-region", Fcharsets_in_region, 2, 3, 0, /*
+Return a list of the charsets in the region between START and END.
+BUFFER defaults to the current buffer if omitted.
+*/
+ (start, end, buffer))
+{
+ /* This function can GC */
+ struct buffer *buf = decode_buffer (buffer, 1);
+ Charbpos pos, stop; /* Limits of the region. */
+ Lisp_Object res = Qnil;
+ int charsets[NUM_LEADING_BYTES];
+ Ibyte lb;
+ struct gcpro gcpro1;
+
+ memset(charsets, 0, sizeof(charsets));
+ get_buffer_range_char (buf, start, end, &pos, &stop, 0);
+
+ GCPRO1 (res);
+ while (pos < stop)
+ {
+ lb = ichar_leading_byte(BUF_FETCH_CHAR (buf, pos));
+ if (0 == charsets[lb - MIN_LEADING_BYTE])
+ {
+ charsets[lb - MIN_LEADING_BYTE] = 1;
+ res = Fcons (XCHARSET_NAME(charset_by_leading_byte(lb)), res);
+ }
+ ++pos;
+ }
+ UNGCPRO;
+
+ return res;
+}
+
/************************************************************************/
/* memory usage */
@@ -1029,6 +1062,7 @@
DEFSUBR (Fcharset_id);
DEFSUBR (Fset_charset_ccl_program);
DEFSUBR (Fset_charset_registries);
+ DEFSUBR (Fcharsets_in_region);
#ifdef MEMORY_USAGE_STATS
DEFSUBR (Fcharset_memory_usage);
--
Santa Maradona, priez pour moi!
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Add a GCPRO, move a warn_when_safe call to where its GCing is irrelevant
17 years, 12 months
Aidan Kehoe
src/ChangeLog addition:
2006-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* objects-xlike-inc.c (x_find_charset_font):
Move the warn_when_safe call to where GCing is irrelevant; as
things are it doesn't GC, but I'm more comfortable without that
being relevant.
* specifier.c (define_specifier_tag):
Remove a couple of lines added for the sake of debugging; add a
GCPRO1 for the allocated vector, since the call_trapping_problems
can GC.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: src/specifier.c
===================================================================
RCS src/objects-xlike-inc.c
===================================================================
RCS
Index: src/objects-xlike-inc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/objects-xlike-inc.c,v
retrieving revision 1.4
diff -u -u -r1.4 objects-xlike-inc.c
--- src/objects-xlike-inc.c 2006/11/12 13:40:09 1.4
+++ src/objects-xlike-inc.c 2006/11/14 21:11:56
@@ -795,10 +795,6 @@
{
Lisp_Object new_registries = make_vector(registries_len + 1, Qnil);
- warn_when_safe (Qface, Qwarning,
- "Your ASCII charset registries contain nothing "
- "sensible. Adding `" FALLBACK_ASCII_REGISTRY "'.");
-
XVECTOR_DATA(new_registries)[0]
= build_string(FALLBACK_ASCII_REGISTRY);
@@ -812,6 +808,10 @@
invalidated and a change to the default face to be
noted. */
set_charset_registries(charset, new_registries);
+
+ warn_when_safe (Qface, Qwarning,
+ "Your ASCII charset registries contain nothing "
+ "sensible. Adding `" FALLBACK_ASCII_REGISTRY "'.");
/* And recurse. */
result =
Index: src/specifier.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/specifier.c,v
retrieving revision 1.49
diff -u -u -r1.49 specifier.c
--- src/specifier.c 2006/11/11 16:05:39 1.49
+++ src/specifier.c 2006/11/14 21:11:57
@@ -1154,9 +1154,9 @@
if (!NILP(charset_predicate))
{
- static int line_1147_calls;
- ++line_1147_calls;
+ struct gcpro gcpro1;
charpres = make_vector(impossible, Qnil);
+ GCPRO1 (charpres);
/* If you want to extend the number of stages available, here
in setup_charset_initial_specifier_tags, and in specifier.h
@@ -1198,6 +1198,7 @@
#undef DEFINE_SPECIFIER_TAG_FROB
+ UNGCPRO;
}
if (!NILP(assoc))
--
Santa Maradona, priez pour moi!
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Update for ruby-modes
18 years
Hans de Graaff
Hi,
I've tried to post this earlier but I think it just got caught in the
mailing list downtime, so I'm sending it again. This patch updates
ruby-modes to the latest version distributed with ruby 1.8.4, including
the addition of ruby-electric.el.
I am not that much of an elisp hacker, especially when it comes to the
incompatibilities between XEmacs and Emacs, so it would be useful if
someone could go over this before it being committed. On the other hand,
I have been using these changes for some time now without any issues
with XEmacs 21.4.19.
Kind regards,
Hans
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches